[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+5PVA7k+6kWoD2moFVjM9X=B3fZJxGrM=C6EVw9UtjEYrk6fQ@mail.gmail.com>
Date: Mon, 20 Nov 2017 12:57:30 -0500
From: Josh Boyer <jwboyer@...oraproject.org>
To: Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Michael Neuling <mikey@...ling.org>, hbabu@...ibm.com,
nicholas.piggin@...il.com,
linuxppc-dev list <linuxppc-dev@...abs.org>,
"Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>,
"kernel-team@...oraproject.org" <kernel-team@...oraproject.org>
Subject: Re: [PATCH v3 10/18] powerpc/vas, nx-842: Define and use chip_to_vas_id()
On Tue, Nov 7, 2017 at 9:23 PM, Sukadev Bhattiprolu
<sukadev@...ux.vnet.ibm.com> wrote:
> Define a helper, chip_to_vas_id() to map a given chip id to corresponding
> vas id.
>
> Normally, callers of vas_rx_win_open() and vas_tx_win_open() want the VAS
> window to be on the same chip where the calling thread is executing. These
> callers can pass in -1 for the VAS id.
>
> This interface will be useful if a thread running on one chip wants to open
> a window on another chip (like the NX-842 driver does during start up).
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
The Fedora kernel team seems to have hit an issue with this commit
when trying to build a rawhide kernel that includes it. The failure
is:
ERROR: "chip_to_vas_id" [drivers/crypto/nx/nx-compress-powernv.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
make: *** [Makefile:1218: modules] Error 2
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.dmbw5D (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.dmbw5D (%build)
Child return code was: 1
EXCEPTION: [Error()]
> ---
> arch/powerpc/include/asm/vas.h | 9 +++++++++
> arch/powerpc/platforms/powernv/vas.c | 11 +++++++++++
> drivers/crypto/nx/nx-842-powernv.c | 18 +++---------------
> 3 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h
> index fd5963a..044748f 100644
> --- a/arch/powerpc/include/asm/vas.h
> +++ b/arch/powerpc/include/asm/vas.h
> @@ -104,6 +104,15 @@ struct vas_tx_win_attr {
> };
>
> /*
> + * Helper to map a chip id to VAS id.
> + * For POWER9, this is a 1:1 mapping. In the future this maybe a 1:N
> + * mapping in which case, we will need to update this helper.
> + *
> + * Return the VAS id or -1 if no matching vasid is found.
> + */
> +int chip_to_vas_id(int chipid);
> +
> +/*
> * Helper to initialize receive window attributes to defaults for an
> * NX window.
> */
> diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c
> index abb7090..cd9a733 100644
> --- a/arch/powerpc/platforms/powernv/vas.c
> +++ b/arch/powerpc/platforms/powernv/vas.c
> @@ -123,6 +123,17 @@ struct vas_instance *find_vas_instance(int vasid)
> return NULL;
> }
>
> +int chip_to_vas_id(int chipid)
> +{
> + int cpu;
> +
> + for_each_possible_cpu(cpu) {
> + if (cpu_to_chip_id(cpu) == chipid)
> + return per_cpu(cpu_vas_id, cpu);
> + }
> + return -1;
> +}
> +
Likely need an EXPORT_SYMBOL here?
> static int vas_probe(struct platform_device *pdev)
> {
> return init_vas_instance(pdev);
> diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c
> index 874ddf5..eb221ed 100644
> --- a/drivers/crypto/nx/nx-842-powernv.c
> +++ b/drivers/crypto/nx/nx-842-powernv.c
Did anyone test this driver built as a module with this commit included?
josh
> @@ -847,24 +847,12 @@ static int __init nx842_powernv_probe_vas(struct device_node *pn)
> return -EINVAL;
> }
>
> - for_each_compatible_node(dn, NULL, "ibm,power9-vas-x") {
> - if (of_get_ibm_chip_id(dn) == chip_id)
> - break;
> - }
> -
> - if (!dn) {
> - pr_err("Missing VAS device node\n");
> + vasid = chip_to_vas_id(chip_id);
> + if (vasid < 0) {
> + pr_err("Unable to map chip_id %d to vasid\n", chip_id);
> return -EINVAL;
> }
>
> - if (of_property_read_u32(dn, "ibm,vas-id", &vasid)) {
> - pr_err("Missing ibm,vas-id device property\n");
> - of_node_put(dn);
> - return -EINVAL;
> - }
> -
> - of_node_put(dn);
> -
> for_each_child_of_node(pn, dn) {
> if (of_device_is_compatible(dn, "ibm,p9-nx-842")) {
> ret = vas_cfg_coproc_info(dn, chip_id, vasid);
> --
> 2.7.4
>
Powered by blists - more mailing lists