Skip to content
Snippets Groups Projects
Select Git revision
  • 462b649cf0cababd909ce2c5e239d371d5443c91
  • master default protected
  • 3.0
  • develop
  • revert-2069-tripleVersion
  • 3.1
  • rest-protocol
  • feat/remoting_rocketmq
  • dapr-support
  • 1.5
  • 1.4
  • 1.3
  • 1.2
  • 1.1
  • v3.0.3-rc2
  • v3.0.3-rc1
  • v3.0.2
  • v1.5.8
  • v1.5.9-rc1
  • v3.0.1
  • v1.5.8-rc1
  • v3.0.0
  • v3.0.0-rc4-1
  • v3.0.0-rc4
  • v3.0.0-rc3
  • v1.5.7
  • v1.5.7-rc2
  • v3.0.0-rc2
  • remove
  • v1.5.7-rc1
  • v3.0.0-rc1
  • v1.5.7-rc1-tmp
  • 1.5.6
  • v1.5.6
34 results

failover_cluster.go

Blame
  • api.c 6.90 KiB
    /*
     * Copyright 2014 IBM Corp.
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * as published by the Free Software Foundation; either version
     * 2 of the License, or (at your option) any later version.
     */
    
    #include <linux/pci.h>
    #include <linux/slab.h>
    #include <linux/anon_inodes.h>
    #include <linux/file.h>
    #include <misc/cxl.h>
    
    #include "cxl.h"
    
    struct cxl_context *cxl_dev_context_init(struct pci_dev *dev)
    {
    	struct cxl_afu *afu;
    	struct cxl_context  *ctx;
    	int rc;
    
    	afu = cxl_pci_to_afu(dev);
    
    	get_device(&afu->dev);
    	ctx = cxl_context_alloc();
    	if (IS_ERR(ctx))
    		return ctx;
    
    	/* Make it a slave context.  We can promote it later? */
    	rc = cxl_context_init(ctx, afu, false, NULL);
    	if (rc) {
    		kfree(ctx);
    		put_device(&afu->dev);
    		return ERR_PTR(-ENOMEM);
    	}
    	cxl_assign_psn_space(ctx);
    
    	return ctx;
    }
    EXPORT_SYMBOL_GPL(cxl_dev_context_init);
    
    struct cxl_context *cxl_get_context(struct pci_dev *dev)
    {
    	return dev->dev.archdata.cxl_ctx;
    }
    EXPORT_SYMBOL_GPL(cxl_get_context);
    
    struct device *cxl_get_phys_dev(struct pci_dev *dev)
    {
    	struct cxl_afu *afu;
    
    	afu = cxl_pci_to_afu(dev);
    
    	return afu->adapter->dev.parent;
    }
    EXPORT_SYMBOL_GPL(cxl_get_phys_dev);
    
    int cxl_release_context(struct cxl_context *ctx)
    {
    	if (ctx->status != CLOSED)
    		return -EBUSY;
    
    	put_device(&ctx->afu->dev);
    
    	cxl_context_free(ctx);
    
    	return 0;
    }