All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Barrat <fbarrat@linux.ibm.com>
To: "Alastair D'Silva" <alastair@au1.ibm.com>, alastair@d-silva.org
Cc: Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 2/7] ocxl: Don't pass pci_dev around
Date: Wed, 17 Apr 2019 15:29:00 +0200	[thread overview]
Message-ID: <6e662291-3e2a-bd98-5c3a-eaa3e79588a9@linux.ibm.com> (raw)
In-Reply-To: <20190327053137.15173-3-alastair@au1.ibm.com>



Le 27/03/2019 à 06:31, Alastair D'Silva a écrit :
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> This data is already available in a struct
> 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---

Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>


>   drivers/misc/ocxl/core.c | 38 +++++++++++++++++++++-----------------
>   1 file changed, 21 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/misc/ocxl/core.c b/drivers/misc/ocxl/core.c
> index 1a4411b72d35..2f2fe12eac1e 100644
> --- a/drivers/misc/ocxl/core.c
> +++ b/drivers/misc/ocxl/core.c
> @@ -66,10 +66,11 @@ static int set_afu_device(struct ocxl_afu *afu, const char *location)
>   	return rc;
>   }
>   
> -static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int assign_afu_actag(struct ocxl_afu *afu)
>   {
>   	struct ocxl_fn *fn = afu->fn;
>   	int actag_count, actag_offset;
> +	struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
>   
>   	/*
>   	 * if there were not enough actags for the function, each afu
> @@ -79,16 +80,16 @@ static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev)
>   		fn->actag_enabled / fn->actag_supported;
>   	actag_offset = ocxl_actag_afu_alloc(fn, actag_count);
>   	if (actag_offset < 0) {
> -		dev_err(&afu->dev, "Can't allocate %d actags for AFU: %d\n",
> +		dev_err(&pci_dev->dev, "Can't allocate %d actags for AFU: %d\n",
>   			actag_count, actag_offset);
>   		return actag_offset;
>   	}
>   	afu->actag_base = fn->actag_base + actag_offset;
>   	afu->actag_enabled = actag_count;
>   
> -	ocxl_config_set_afu_actag(dev, afu->config.dvsec_afu_control_pos,
> +	ocxl_config_set_afu_actag(pci_dev, afu->config.dvsec_afu_control_pos,
>   				afu->actag_base, afu->actag_enabled);
> -	dev_dbg(&afu->dev, "actag base=%d enabled=%d\n",
> +	dev_dbg(&pci_dev->dev, "actag base=%d enabled=%d\n",
>   		afu->actag_base, afu->actag_enabled);
>   	return 0;
>   }
> @@ -103,10 +104,11 @@ static void reclaim_afu_actag(struct ocxl_afu *afu)
>   	ocxl_actag_afu_free(afu->fn, start_offset, size);
>   }
>   
> -static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int assign_afu_pasid(struct ocxl_afu *afu)
>   {
>   	struct ocxl_fn *fn = afu->fn;
>   	int pasid_count, pasid_offset;
> +	struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
>   
>   	/*
>   	 * We only support the case where the function configuration
> @@ -115,7 +117,7 @@ static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
>   	pasid_count = 1 << afu->config.pasid_supported_log;
>   	pasid_offset = ocxl_pasid_afu_alloc(fn, pasid_count);
>   	if (pasid_offset < 0) {
> -		dev_err(&afu->dev, "Can't allocate %d PASIDs for AFU: %d\n",
> +		dev_err(&pci_dev->dev, "Can't allocate %d PASIDs for AFU: %d\n",
>   			pasid_count, pasid_offset);
>   		return pasid_offset;
>   	}
> @@ -123,10 +125,10 @@ static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
>   	afu->pasid_count = 0;
>   	afu->pasid_max = pasid_count;
>   
> -	ocxl_config_set_afu_pasid(dev, afu->config.dvsec_afu_control_pos,
> +	ocxl_config_set_afu_pasid(pci_dev, afu->config.dvsec_afu_control_pos,
>   				afu->pasid_base,
>   				afu->config.pasid_supported_log);
> -	dev_dbg(&afu->dev, "PASID base=%d, enabled=%d\n",
> +	dev_dbg(&pci_dev->dev, "PASID base=%d, enabled=%d\n",
>   		afu->pasid_base, pasid_count);
>   	return 0;
>   }
> @@ -172,9 +174,10 @@ static void release_fn_bar(struct ocxl_fn *fn, int bar)
>   	WARN_ON(fn->bar_used[idx] < 0);
>   }
>   
> -static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int map_mmio_areas(struct ocxl_afu *afu)
>   {
>   	int rc;
> +	struct pci_dev *pci_dev = to_pci_dev(afu->fn->dev.parent);
>   
>   	rc = reserve_fn_bar(afu->fn, afu->config.global_mmio_bar);
>   	if (rc)
> @@ -187,10 +190,10 @@ static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
>   	}
>   
>   	afu->global_mmio_start =
> -		pci_resource_start(dev, afu->config.global_mmio_bar) +
> +		pci_resource_start(pci_dev, afu->config.global_mmio_bar) +
>   		afu->config.global_mmio_offset;
>   	afu->pp_mmio_start =
> -		pci_resource_start(dev, afu->config.pp_mmio_bar) +
> +		pci_resource_start(pci_dev, afu->config.pp_mmio_bar) +
>   		afu->config.pp_mmio_offset;
>   
>   	afu->global_mmio_ptr = ioremap(afu->global_mmio_start,
> @@ -198,7 +201,7 @@ static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
>   	if (!afu->global_mmio_ptr) {
>   		release_fn_bar(afu->fn, afu->config.pp_mmio_bar);
>   		release_fn_bar(afu->fn, afu->config.global_mmio_bar);
> -		dev_err(&dev->dev, "Error mapping global mmio area\n");
> +		dev_err(&pci_dev->dev, "Error mapping global mmio area\n");
>   		return -ENOMEM;
>   	}
>   
> @@ -234,17 +237,17 @@ static int configure_afu(struct ocxl_afu *afu, u8 afu_idx, struct pci_dev *dev)
>   	if (rc)
>   		return rc;
>   
> -	rc = assign_afu_actag(afu, dev);
> +	rc = assign_afu_actag(afu);
>   	if (rc)
>   		return rc;
>   
> -	rc = assign_afu_pasid(afu, dev);
> +	rc = assign_afu_pasid(afu);
>   	if (rc) {
>   		reclaim_afu_actag(afu);
>   		return rc;
>   	}
>   
> -	rc = map_mmio_areas(afu, dev);
> +	rc = map_mmio_areas(afu);
>   	if (rc) {
>   		reclaim_afu_pasid(afu);
>   		reclaim_afu_actag(afu);
> @@ -331,7 +334,7 @@ void remove_afu(struct ocxl_afu *afu)
>   	device_unregister(&afu->dev);
>   }
>   
> -static struct ocxl_fn *alloc_function(struct pci_dev *dev)
> +static struct ocxl_fn *alloc_function(void)
>   {
>   	struct ocxl_fn *fn;
>   
> @@ -342,6 +345,7 @@ static struct ocxl_fn *alloc_function(struct pci_dev *dev)
>   	INIT_LIST_HEAD(&fn->afu_list);
>   	INIT_LIST_HEAD(&fn->pasid_list);
>   	INIT_LIST_HEAD(&fn->actag_list);
> +
>   	return fn;
>   }
>   
> @@ -491,7 +495,7 @@ struct ocxl_fn *init_function(struct pci_dev *dev)
>   	struct ocxl_fn *fn;
>   	int rc;
>   
> -	fn = alloc_function(dev);
> +	fn = alloc_function();
>   	if (!fn)
>   		return ERR_PTR(-ENOMEM);
>   
> 


WARNING: multiple messages have this Message-ID (diff)
From: Frederic Barrat <fbarrat@linux.ibm.com>
To: "Alastair D'Silva" <alastair@au1.ibm.com>, alastair@d-silva.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linuxppc-dev@lists.ozlabs.org, Arnd Bergmann <arnd@arndb.de>,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/7] ocxl: Don't pass pci_dev around
Date: Wed, 17 Apr 2019 15:29:00 +0200	[thread overview]
Message-ID: <6e662291-3e2a-bd98-5c3a-eaa3e79588a9@linux.ibm.com> (raw)
In-Reply-To: <20190327053137.15173-3-alastair@au1.ibm.com>



Le 27/03/2019 à 06:31, Alastair D'Silva a écrit :
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> This data is already available in a struct
> 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---

Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>


>   drivers/misc/ocxl/core.c | 38 +++++++++++++++++++++-----------------
>   1 file changed, 21 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/misc/ocxl/core.c b/drivers/misc/ocxl/core.c
> index 1a4411b72d35..2f2fe12eac1e 100644
> --- a/drivers/misc/ocxl/core.c
> +++ b/drivers/misc/ocxl/core.c
> @@ -66,10 +66,11 @@ static int set_afu_device(struct ocxl_afu *afu, const char *location)
>   	return rc;
>   }
>   
> -static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int assign_afu_actag(struct ocxl_afu *afu)
>   {
>   	struct ocxl_fn *fn = afu->fn;
>   	int actag_count, actag_offset;
> +	struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
>   
>   	/*
>   	 * if there were not enough actags for the function, each afu
> @@ -79,16 +80,16 @@ static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev)
>   		fn->actag_enabled / fn->actag_supported;
>   	actag_offset = ocxl_actag_afu_alloc(fn, actag_count);
>   	if (actag_offset < 0) {
> -		dev_err(&afu->dev, "Can't allocate %d actags for AFU: %d\n",
> +		dev_err(&pci_dev->dev, "Can't allocate %d actags for AFU: %d\n",
>   			actag_count, actag_offset);
>   		return actag_offset;
>   	}
>   	afu->actag_base = fn->actag_base + actag_offset;
>   	afu->actag_enabled = actag_count;
>   
> -	ocxl_config_set_afu_actag(dev, afu->config.dvsec_afu_control_pos,
> +	ocxl_config_set_afu_actag(pci_dev, afu->config.dvsec_afu_control_pos,
>   				afu->actag_base, afu->actag_enabled);
> -	dev_dbg(&afu->dev, "actag base=%d enabled=%d\n",
> +	dev_dbg(&pci_dev->dev, "actag base=%d enabled=%d\n",
>   		afu->actag_base, afu->actag_enabled);
>   	return 0;
>   }
> @@ -103,10 +104,11 @@ static void reclaim_afu_actag(struct ocxl_afu *afu)
>   	ocxl_actag_afu_free(afu->fn, start_offset, size);
>   }
>   
> -static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int assign_afu_pasid(struct ocxl_afu *afu)
>   {
>   	struct ocxl_fn *fn = afu->fn;
>   	int pasid_count, pasid_offset;
> +	struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
>   
>   	/*
>   	 * We only support the case where the function configuration
> @@ -115,7 +117,7 @@ static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
>   	pasid_count = 1 << afu->config.pasid_supported_log;
>   	pasid_offset = ocxl_pasid_afu_alloc(fn, pasid_count);
>   	if (pasid_offset < 0) {
> -		dev_err(&afu->dev, "Can't allocate %d PASIDs for AFU: %d\n",
> +		dev_err(&pci_dev->dev, "Can't allocate %d PASIDs for AFU: %d\n",
>   			pasid_count, pasid_offset);
>   		return pasid_offset;
>   	}
> @@ -123,10 +125,10 @@ static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
>   	afu->pasid_count = 0;
>   	afu->pasid_max = pasid_count;
>   
> -	ocxl_config_set_afu_pasid(dev, afu->config.dvsec_afu_control_pos,
> +	ocxl_config_set_afu_pasid(pci_dev, afu->config.dvsec_afu_control_pos,
>   				afu->pasid_base,
>   				afu->config.pasid_supported_log);
> -	dev_dbg(&afu->dev, "PASID base=%d, enabled=%d\n",
> +	dev_dbg(&pci_dev->dev, "PASID base=%d, enabled=%d\n",
>   		afu->pasid_base, pasid_count);
>   	return 0;
>   }
> @@ -172,9 +174,10 @@ static void release_fn_bar(struct ocxl_fn *fn, int bar)
>   	WARN_ON(fn->bar_used[idx] < 0);
>   }
>   
> -static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int map_mmio_areas(struct ocxl_afu *afu)
>   {
>   	int rc;
> +	struct pci_dev *pci_dev = to_pci_dev(afu->fn->dev.parent);
>   
>   	rc = reserve_fn_bar(afu->fn, afu->config.global_mmio_bar);
>   	if (rc)
> @@ -187,10 +190,10 @@ static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
>   	}
>   
>   	afu->global_mmio_start =
> -		pci_resource_start(dev, afu->config.global_mmio_bar) +
> +		pci_resource_start(pci_dev, afu->config.global_mmio_bar) +
>   		afu->config.global_mmio_offset;
>   	afu->pp_mmio_start =
> -		pci_resource_start(dev, afu->config.pp_mmio_bar) +
> +		pci_resource_start(pci_dev, afu->config.pp_mmio_bar) +
>   		afu->config.pp_mmio_offset;
>   
>   	afu->global_mmio_ptr = ioremap(afu->global_mmio_start,
> @@ -198,7 +201,7 @@ static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
>   	if (!afu->global_mmio_ptr) {
>   		release_fn_bar(afu->fn, afu->config.pp_mmio_bar);
>   		release_fn_bar(afu->fn, afu->config.global_mmio_bar);
> -		dev_err(&dev->dev, "Error mapping global mmio area\n");
> +		dev_err(&pci_dev->dev, "Error mapping global mmio area\n");
>   		return -ENOMEM;
>   	}
>   
> @@ -234,17 +237,17 @@ static int configure_afu(struct ocxl_afu *afu, u8 afu_idx, struct pci_dev *dev)
>   	if (rc)
>   		return rc;
>   
> -	rc = assign_afu_actag(afu, dev);
> +	rc = assign_afu_actag(afu);
>   	if (rc)
>   		return rc;
>   
> -	rc = assign_afu_pasid(afu, dev);
> +	rc = assign_afu_pasid(afu);
>   	if (rc) {
>   		reclaim_afu_actag(afu);
>   		return rc;
>   	}
>   
> -	rc = map_mmio_areas(afu, dev);
> +	rc = map_mmio_areas(afu);
>   	if (rc) {
>   		reclaim_afu_pasid(afu);
>   		reclaim_afu_actag(afu);
> @@ -331,7 +334,7 @@ void remove_afu(struct ocxl_afu *afu)
>   	device_unregister(&afu->dev);
>   }
>   
> -static struct ocxl_fn *alloc_function(struct pci_dev *dev)
> +static struct ocxl_fn *alloc_function(void)
>   {
>   	struct ocxl_fn *fn;
>   
> @@ -342,6 +345,7 @@ static struct ocxl_fn *alloc_function(struct pci_dev *dev)
>   	INIT_LIST_HEAD(&fn->afu_list);
>   	INIT_LIST_HEAD(&fn->pasid_list);
>   	INIT_LIST_HEAD(&fn->actag_list);
> +
>   	return fn;
>   }
>   
> @@ -491,7 +495,7 @@ struct ocxl_fn *init_function(struct pci_dev *dev)
>   	struct ocxl_fn *fn;
>   	int rc;
>   
> -	fn = alloc_function(dev);
> +	fn = alloc_function();
>   	if (!fn)
>   		return ERR_PTR(-ENOMEM);
>   
> 


  reply	other threads:[~2019-04-17 13:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  5:31 [PATCH v4 0/7] Refactor OCXL driver to allow external drivers to use it Alastair D'Silva
2019-03-27  5:31 ` Alastair D'Silva
2019-03-27  5:31 ` [PATCH v4 1/7] ocxl: Split pci.c Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 13:22   ` Frederic Barrat
2019-04-17 13:22     ` Frederic Barrat
2019-04-30  4:20   ` Andrew Donnellan
2019-04-30  4:20     ` Andrew Donnellan
2019-05-03  6:59   ` Michael Ellerman
2019-03-27  5:31 ` [PATCH v4 2/7] ocxl: Don't pass pci_dev around Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 13:29   ` Frederic Barrat [this message]
2019-04-17 13:29     ` Frederic Barrat
2019-04-30  4:25   ` Andrew Donnellan
2019-04-30  4:25     ` Andrew Donnellan
2019-03-27  5:31 ` [PATCH v4 3/7] ocxl: Create a clear delineation between ocxl backend & frontend Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 15:29   ` Frederic Barrat
2019-04-17 15:29     ` Frederic Barrat
2019-03-27  5:31 ` [PATCH v4 4/7] ocxl: Allow external drivers to use OpenCAPI contexts Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 15:33   ` Frederic Barrat
2019-04-17 15:33     ` Frederic Barrat
2019-03-27  5:31 ` [PATCH v4 5/7] ocxl: afu_irq only deals with IRQ IDs, not offsets Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 15:33   ` Frederic Barrat
2019-04-17 15:33     ` Frederic Barrat
2019-03-27  5:31 ` [PATCH v4 6/7] ocxl: move event_fd handling to frontend Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 15:33   ` Frederic Barrat
2019-04-17 15:33     ` Frederic Barrat
2019-03-27  5:31 ` [PATCH v4 7/7] ocxl: Provide global MMIO accessors for external drivers Alastair D'Silva
2019-03-27  5:31   ` Alastair D'Silva
2019-04-17 15:35   ` Frederic Barrat
2019-04-17 15:35     ` Frederic Barrat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6e662291-3e2a-bd98-5c3a-eaa3e79588a9@linux.ibm.com \
    --to=fbarrat@linux.ibm.com \
    --cc=alastair@au1.ibm.com \
    --cc=alastair@d-silva.org \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.