Use CCP driver to handle PSP I2C arbitration
Subsystems (6)
Mario Limonciello
maintainerv7 cover Use CCP driver to handle PSP I2C arbitration
The CCP driver now has symbols that can be used by i2c-designware-amdpsp to handle the communication regarding i2c arbitration with the PSP for both Cezanne and Mendocino based designs.
Utilize those symbols.
Mario Limonciello (6):
crypto: ccp: Drop extra doorbell checks
crypto: ccp: Bump up doorbell debug message to error
crypto: ccp: Return doorbell status code as an argument
crypto: ccp: Use lower 8 bytes to communicate with doorbell command
register
i2c: designware: Use PCI PSP driver for communication
i2c: designware: Add doorbell support for Mendocino
drivers/crypto/ccp/platform-access.c | 31 +-- drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-designware-amdpsp.c | 199 +++++--------------- drivers/i2c/busses/i2c-designware-core.h | 1 - drivers/i2c/busses/i2c-designware-platdrv.c | 1 - include/linux/psp-platform-access.h | 5 +- 6 files changed, 62 insertions(+), 179 deletions(-)
base-commit: 9117e682b8b79f7b5e2517fd28d42757d3e8b860
Signature · 1 line
2.34.1
Mario Limonciello
maintainerPATCH v7 1/6 crypto: ccp: Drop extra doorbell checks
The doorbell register set used for I2C arbitration is dedicated for this purpose and there is no need to utilize other safety checks the platform access register set uses.
---v6->v7:
* new patch
--- drivers/crypto/ccp/platform-access.c | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/crypto/ccp/platform-access.c +0 -20
@@ -20,14 +20,6 @@#define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC) -/* Doorbell shouldn't be ringing */ -static int check_doorbell (u32 __iomem *doorbell) -{ -u32 tmp; - -return readl_poll_timeout (doorbell, tmp, tmp !=0 ,0 ,PSP_CMD_TIMEOUT_US ); -} -/* Recovery field should be equal 0 to start sending commands */ static int check_recovery (u32 __iomem *cmd) {
@@ -156,18 +148,6 @@ int psp_ring_platform_doorbell(int msg)mutex_lock (&pa_dev->doorbell_mutex); -if (check_doorbell (button)) { -dev_dbg (psp->dev,"doorbell is not ready\n" ); - ret = -EBUSY ; - goto unlock; - } - -if (check_recovery (cmd)) { -dev_dbg (psp->dev,"doorbell command in recovery\n" ); - ret = -EBUSY ; - goto unlock; - } -if (wait_cmd (cmd)) {dev_dbg (psp->dev,"doorbell command not done processing\n" ); ret = -EBUSY ;
base-commit: 9117e682b8b79f7b5e2517fd28d42757d3e8b860
Signature · 1 line
2.34.1
Re: [PATCH v7 1/6] crypto: ccp: Drop extra doorbell checks
Mario Limonciello
maintainerPATCH v7 2/6 crypto: ccp: Bump up doorbell debug message to error
In reply to Mario LimoncielloThis is helpful not just for debugging problems, but also for investigating captured logs later on.
--- drivers/crypto/ccp/platform-access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccp/platform-access.c +1 -1
@@ -149,7 +149,7 @@ int psp_ring_platform_doorbell(int msg)mutex_lock (&pa_dev->doorbell_mutex);if (wait_cmd (cmd)) { -dev_dbg (psp->dev,"doorbell command not done processing\n" ); +dev_err (psp->dev,"doorbell command not done processing\n" ); ret = -EBUSY ; goto unlock; }
Signature · 1 line
2.34.1
Mario Limonciello
maintainerPATCH v7 3/6 crypto: ccp: Return doorbell status code as an argument
In reply to Mario LimoncielloIf the doorbell failed to ring we return -EIO, but the caller can't determine why it failed. Pass the reason for the failure in an argument for caller to investigate.
---v5->v6:
* New patch
--- drivers/crypto/ccp/platform-access.c | 4 +++- include/linux/psp-platform-access.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/ccp/platform-access.c +3 -1
@@ -132,7 +132,7 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, }EXPORT_SYMBOL_GPL (psp_send_platform_access_msg); -int psp_ring_platform_doorbell (int msg) +int psp_ring_platform_doorbell (int msg,u32 *result) {struct psp_device *psp =psp_get_master_device ();struct psp_platform_access_device *pa_dev;
@@ -164,6 +164,8 @@ int psp_ring_platform_doorbell(int msg) val =FIELD_GET (PSP_CMDRESP_STS ,ioread32 (cmd));if (val) { +if (result) + *result = val; ret = -EIO ; goto unlock; }
include/linux/psp-platform-access.h +2 -2
@@ -45,9 +45,9 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg, struct psp_reques* -%EBUSY: mailbox in recovery or in use * -%ENODEV: driver not bound with PSP device * -%ETIMEDOUT: request timed out -* -%EIO: unknown error (see kernel log) +* -%EIO: error will be stored in result argument */ -int psp_ring_platform_doorbell (int msg); +int psp_ring_platform_doorbell (int msg,u32 *result);/** * psp_check_platform_access_status() - Checks whether platform features is ready
Signature · 1 line
2.34.1
Re: [PATCH v7 3/6] crypto: ccp: Return doorbell status code as an argument
Mario Limonciello
maintainerPATCH v7 4/6 crypto: ccp: Use lower 8 bytes to communicate with doorbell command register
In reply to Mario LimoncielloUnlike other command registers used by the PSP, only the lower 8 bytes are used for communication for both command and status of the command.
---v6->v7:
* New patch
--- drivers/crypto/ccp/platform-access.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/ccp/platform-access.c +3 -2
@@ -19,6 +19,7 @@#include "platform-access.h" #define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC) +#define DOORBELL_CMDRESP_STS GENMASK(7, 0)/* Recovery field should be equal 0 to start sending commands */ static int check_recovery (u32 __iomem *cmd)
@@ -154,7 +155,7 @@ int psp_ring_platform_doorbell(int msg, u32 *result) goto unlock; } -iowrite32 (FIELD_PREP (PSP_DRBL_MSG , msg), cmd); +iowrite32 (FIELD_PREP (DOORBELL_CMDRESP_STS , msg), cmd);iowrite32 (PSP_DRBL_RING , button);if (wait_cmd (cmd)) {
@@ -162,7 +163,7 @@ int psp_ring_platform_doorbell(int msg, u32 *result) goto unlock; } - val =FIELD_GET (PSP_CMDRESP_STS ,ioread32 (cmd)); + val =FIELD_GET (DOORBELL_CMDRESP_STS ,ioread32 (cmd));if (val) {if (result) *result = val;
Signature · 1 line
2.34.1
Re: [PATCH v7 4/6] crypto: ccp: Use lower 8 bytes to communicate with doorbell command register
Quoted 2 lines
Unlike other command registers used by the PSP, only the lower 8 bytes are used for communication for both command and status of the command.
nit; bytes -> bits
Mario Limonciello
maintainerPATCH v7 5/6 i2c: designware: Use PCI PSP driver for communication
In reply to Mario LimoncielloCurrently the PSP semaphore communication base address is discovered by using an MSR that is not architecturally guaranteed for future platforms. Also the mailbox that is utilized for communication with the PSP may have other consumers in the kernel, so it's better to make all communication go through a single driver.
---v6->v7:
* Also imply CRYPTO_DEV_CCP_DD to fix build errors
* Fix error message acquire/release inversionv5->v6:
* Drop now unnecessary asm/msr.h header
* Fix IS_REACHABLE
* Drop tags
* Fix status code handling for Cezannev4->v5:
* Pick up tagsv3->v4:
* Pick up tagsv1->v2:
* Fix Kconfig to use imply
* Use IS_REACHABLE
--- drivers/i2c/busses/Kconfig | 3 +- drivers/i2c/busses/i2c-designware-amdpsp.c | 177 +++----------------- drivers/i2c/busses/i2c-designware-core.h | 1 - drivers/i2c/busses/i2c-designware-platdrv.c | 1 - include/linux/psp-platform-access.h | 1 + 5 files changed, 29 insertions(+), 154 deletions(-)
drivers/i2c/busses/Kconfig +2 -1
@@ -566,9 +566,10 @@ config I2C_DESIGNWARE_PLATFORM config I2C_DESIGNWARE_AMDPSP bool "AMD PSP I2C semaphore support" - depends on X86_MSR depends on ACPI depends on I2C_DESIGNWARE_PLATFORM + imply CRYPTO_DEV_SP_PSP + imply CRYPTO_DEV_CCP_DD help This driver enables managed host access to the selected I2C bus shared between AMD CPU and AMD PSP.
drivers/i2c/busses/i2c-designware-amdpsp.c +26 -151
247 lines not on this page · raw message
drivers/i2c/busses/i2c-designware-core.h +0 -1
@@ -383,7 +383,6 @@ int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev);#if IS_ENABLED (CONFIG_I2C_DESIGNWARE_AMDPSP )int i2c_dw_amdpsp_probe_lock_support (struct dw_i2c_dev *dev); -void i2c_dw_amdpsp_remove_lock_support (struct dw_i2c_dev *dev);#endif int i2c_dw_validate_speed (struct dw_i2c_dev *dev);
drivers/i2c/busses/i2c-designware-platdrv.c +0 -1
@@ -214,7 +214,6 @@ static const struct i2c_dw_semaphore_callbacks i2c_dw_semaphore_cb_table[] = { #ifdef CONFIG_I2C_DESIGNWARE_AMDPSP { .probe = i2c_dw_amdpsp_probe_lock_support, - .remove = i2c_dw_amdpsp_remove_lock_support, }, #endif {}
include/linux/psp-platform-access.h +1 -0
@@ -7,6 +7,7 @@enum psp_platform_access_msg {PSP_CMD_NONE =0x0 , +PSP_I2C_REQ_BUS_CMD =0x64 , };struct psp_req_buffer_hdr {
Signature · 1 line
2.34.1
Re: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communication
Quoted 23 lines · Mario Limonciello
Currently the PSP semaphore communication base address is discovered by using an MSR that is not architecturally guaranteed for future platforms. Also the mailbox that is utilized for communication with the PSP may have other consumers in the kernel, so it's better to make all communication go through a single driver.
Signed-off-by Mario Limonciello <[email protected]>---
v6->v7:
* Also implyCRYPTO_DEV_CCP_DDto fix build errors
* Fix error message acquire/release inversionv5->v6:
* Drop now unnecessaryasm/msr.hheader
* FixIS_REACHABLE
* Drop tags
* Fix status code handling for Cezannev4->v5:
* Pick up tagsv3->v4:
* Pick up tagsv1->v2:
* FixKconfigto use imply
* UseIS_REACHABLE
Quoted 8 lines
--- drivers/i2c/busses/Kconfig | 3 +- drivers/i2c/busses/i2c-designware-amdpsp.c | 177 +++----------------- drivers/i2c/busses/i2c-designware-core.h | 1 - drivers/i2c/busses/i2c-designware-platdrv.c | 1 - include/linux/psp-platform-access.h | 1 + 5 files changed, 29 insertions(+), 154 deletions(-)
One note below in case there is a need to have another version of if you want. Not a show stopper for this.
drivers/i2c/busses/i2c-designware-amdpsp.c static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) · line 101
Quoted 9 lines
drivers/i2c/busses/i2c-designware-amdpsp.c +1
-1@@ -214,7 +95,7 @@ static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type)if (ret) {dev_err (psp_i2c_dev,"Timed out waiting for PSP to %s I2C bus\n" , (i2c_req_type ==PSP_I2C_REQ_ACQUIRE ) ? -"release" :"acquire" ); +"acquire" :"release" ); goto cleanup; }
This looks like worth of being an own patch. Maybe even for the linux-stable. I think it's very useful to have an error message to show correct information what operation actually failed.
Re: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communication
pt., 31 mar 2023 o 13:53 Jarkko Nikula <[email protected]> napisał(a):
Quoted 38 lines · Mario Limonciello
Quoted 23 lines
Currently the PSP semaphore communication base address is discovered by using an MSR that is not architecturally guaranteed for future platforms. Also the mailbox that is utilized for communication with the PSP may have other consumers in the kernel, so it's better to make all communication go through a single driver.
Signed-off-by Mario Limonciello <[email protected]>---
v6->v7:
* Also implyCRYPTO_DEV_CCP_DDto fix build errors
* Fix error message acquire/release inversionv5->v6:
* Drop now unnecessaryasm/msr.hheader
* FixIS_REACHABLE
* Drop tags
* Fix status code handling for Cezannev4->v5:
* Pick up tagsv3->v4:
* Pick up tagsv1->v2:
* FixKconfigto use imply
* UseIS_REACHABLEQuoted 8 lines
--- drivers/i2c/busses/Kconfig | 3 +- drivers/i2c/busses/i2c-designware-amdpsp.c | 177 +++----------------- drivers/i2c/busses/i2c-designware-core.h | 1 - drivers/i2c/busses/i2c-designware-platdrv.c | 1 - include/linux/psp-platform-access.h | 1 + 5 files changed, 29 insertions(+), 154 deletions(-)One note below in case there is a need to have another version of if you want. Not a show stopper for this.
Acked-by Jarkko Nikula <[email protected]>
Quoted 12 lines
drivers/i2c/busses/i2c-designware-amdpsp.c static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) · line 101
Quoted 9 lines
drivers/i2c/busses/i2c-designware-amdpsp.c +1
-1@@ -214,7 +95,7 @@ static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type)if (ret) {dev_err (psp_i2c_dev,"Timed out waiting for PSP to %s I2C bus\n" , (i2c_req_type ==PSP_I2C_REQ_ACQUIRE ) ? -"release" :"acquire" ); +"acquire" :"release" ); goto cleanup; }This looks like worth of being an own patch. Maybe even for the linux-stable. I think it's very useful to have an error message to show correct information what operation actually failed.
Msg here is "TImed out waiting for _PSP to_ %s I2C bus" - when x86 wants to ACQUIRE the bus (i2c_req_type == PSP_I2C_REQ_ACQUIRE) then PSP needs to RELEASE it and vice versa. If you think logic here is not straightforward and should be adjusted, then we need to change the whole sentence.
Limonciello, Mario
maintainerRE: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communication
[Public]
Quoted 67 lines
-----Original Message-----
From: Jan Dąbroś <[email protected]>
Sent: Friday, March 31, 2023 07:04
To: Jarkko Nikula <[email protected]>
Cc: Limonciello, Mario <[email protected]>; Grzegorz Bernacki <[email protected]>; Mark Hasemeyer <[email protected]>; Andy Shevchenko <[email protected]>; Mika Westerberg <[email protected]>; Held, Felix <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communicationpt., 31 mar 2023 o 13:53 Jarkko Nikula <[email protected]> napisał(a):
Quoted 33 lines · Mario Limonciello
Quoted 23 lines
Currently the PSP semaphore communication base address is discovered by using an MSR that is not architecturally guaranteed for future platforms. Also the mailbox that is utilized for communication with the PSP may have other consumers in the kernel, so it's better to make all communication go through a single driver.
Signed-off-by Mario Limonciello <[email protected]>---
v6->v7:
* Also implyCRYPTO_DEV_CCP_DDto fix build errors
* Fix error message acquire/release inversionv5->v6:
* Drop now unnecessaryasm/msr.hheader
* FixIS_REACHABLE
* Drop tags
* Fix status code handling for Cezannev4->v5:
* Pick up tagsv3->v4:
* Pick up tagsv1->v2:
* FixKconfigto use imply
* UseIS_REACHABLEQuoted 8 lines
--- drivers/i2c/busses/Kconfig | 3 +- drivers/i2c/busses/i2c-designware-amdpsp.c | 177 +++----------------- drivers/i2c/busses/i2c-designware-core.h | 1 - drivers/i2c/busses/i2c-designware-platdrv.c | 1 - include/linux/psp-platform-access.h | 1 + 5 files changed, 29 insertions(+), 154 deletions(-)Quoted 6 lines
One note below in case there is a need to have another version of if you want. Not a show stopper for this.
Acked-by Jarkko Nikula <[email protected]>Review static int psp_send_i2c_req(enum
Quoted 1 line
(quoted diff) +0
-0@@ -214,7 +95,7 @@ static int psp_send_i2c_req(enum
psp_i2c_req_typei2c_req_type)Quoted 2 lines
Review static int psp_send_i2c_req(enum · line 96
Quoted 2 lines
(quoted diff) +0
-0if (ret) { dev_err(psp_i2c_dev, "Timed out waiting for PSP to %s I2Cbus\n",
Quoted 9 lines
drivers/i2c/busses/i2c-designware-amdpsp.c static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) · line 101
Quoted 6 lines
drivers/i2c/busses/i2c-designware-amdpsp.c +1
-1(i2c_req_type ==PSP_I2C_REQ_ACQUIRE ) ? - "release" : "acquire"); + "acquire" : "release"); goto cleanup; }This looks like worth of being an own patch. Maybe even for the linux-stable. I think it's very useful to have an error message to show correct information what operation actually failed.
Quoted 5 lines
Msg here is "TImed out waiting for
_PSPto_%s I2C bus" - when x86 wants to ACQUIRE the bus (i2c_req_type==PSP_I2C_REQ_ACQUIRE) then PSP needs to RELEASE it and vice versa. If you think logic here is not straightforward and should be adjusted, then we need to change the whole sentence.
Thanks for clarifying it. We should just drop this hunk then, it was correct previously.
I'll wait for Mark or Grzegorz testing results to spin again with the tags And dropping this hunk.
Mark Hasemeyer
Reviewed-byRe: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communication
kernel test robot
build botRe: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communication
In reply to Mario LimoncielloThank you for the patch! Yet something to improve:
Hi Mario,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on 9117e682b8b79f7b5e2517fd28d42757d3e8b860]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/crypto-ccp-Drop-extra-doorbell-checks/20230330-060959 base: 9117e682b8b79f7b5e2517fd28d42757d3e8b860 patch link: https://lore.kernel.org/r/20230329220753.7741-6-mario.limonciello%40amd.com patch subject: [PATCH v7 5/6] i2c: designware: Use PCI PSP driver for communication config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230401/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/0bb8c75c296f066a77162eacc6170c0d8fbcf0b6
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mario-Limonciello/crypto-ccp-Drop-extra-doorbell-checks/20230330-060959 git checkout 0bb8c75c296f066a77162eacc6170c0d8fbcf0b6
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
ld: drivers/i2c/busses/i2c-designware-amdpsp.o: in function `psp_send_i2c_req':
>> i2c-designware-amdpsp.c:(.text+0x77): undefined reference to `psp_send_platform_access_msg' ld: i2c-designware-amdpsp.c:(.text+0xbb): undefined reference to `psp_send_platform_access_msg' ld: drivers/i2c/busses/i2c-designware-amdpsp.o: in function `i2c_dw_amdpsp_probe_lock_support': >> i2c-designware-amdpsp.c:(.text+0x400): undefined reference to `psp_check_platform_access_status'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Mario Limonciello
maintainerPATCH v7 6/6 i2c: designware: Add doorbell support for Mendocino
In reply to Mario LimoncielloMendocino and later platform don't use the platform feature mailbox for communication for I2C arbitration, they rely upon ringing a doorbell.
Detect the platform by the device ID of the root port and choose the appropriate method.
---v6->v7:
* Add missing pci_dev_put()
* s/mendocino/doorbell/v5->v6:
* Handle Mendocino busy code like Cezannev4->v5:
* Poll for busy
* Rename to mendocino
* Add explicit dependency on PCIv3->v4:
* Adjust to use PCI device ID and function pointers insteadv2->v3:
* Use CPU ID rather than ACPI ID, this will be pushed to a later patchv1->v2:
* New patch
--- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-designware-amdpsp.c | 26 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +1 -0
@@ -568,6 +568,7 @@ config I2C_DESIGNWARE_AMDPSP bool "AMD PSP I2C semaphore support" depends on ACPI depends on I2C_DESIGNWARE_PLATFORM + depends on PCI imply CRYPTO_DEV_SP_PSP imply CRYPTO_DEV_CCP_DD help
drivers/i2c/busses/i2c-designware-amdpsp.c +25 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/i2c.h> +#include <linux/pci.h> #include <linux/psp-platform-access.h> #include <linux/psp.h> #include <linux/workqueue.h>
@@ -32,6 +33,8 @@ static u32 psp_i2c_access_count;static bool psp_i2c_mbox_fail;static struct device *psp_i2c_dev; +static int (*_psp_send_i2c_req)(struct psp_i2c_req *req); +/* Helper to verify status returned by PSP */ static int check_i2c_req_sts (struct psp_i2c_req *req) {
@@ -72,6 +75,17 @@ static int psp_send_i2c_req_cezanne(struct psp_i2c_req *req)return ret; } +static int psp_send_i2c_req_doorbell (struct psp_i2c_req *req) +{ +int ret; + + ret =psp_ring_platform_doorbell (req->type, &req->hdr.status); +if (ret == -EIO ) +return check_i2c_req_sts (req); + +return ret; +} +static int psp_send_i2c_req (enum psp_i2c_req_type i2c_req_type) {struct psp_i2c_req *req;
@@ -87,7 +101,7 @@ static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) req->type = i2c_req_type; start = jiffies; - ret = read_poll_timeout(psp_send_i2c_req_cezanne, status, + ret = read_poll_timeout(_psp_send_i2c_req, status, (status != -EBUSY), PSP_I2C_REQ_RETRY_DELAY_US, PSP_I2C_REQ_RETRY_CNT * PSP_I2C_REQ_RETRY_DELAY_US,
@@ -262,6 +276,8 @@ static const struct i2c_lock_operations i2c_dw_psp_lock_ops = {int i2c_dw_amdpsp_probe_lock_support (struct dw_i2c_dev *dev) { +struct pci_dev *rdev; +if (!IS_REACHABLE (CONFIG_CRYPTO_DEV_CCP_DD ))return -ENODEV ;
@@ -275,6 +291,14 @@ int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev)if (psp_i2c_dev)return -EEXIST ; +/* Cezanne uses platform mailbox, Mendocino and later use doorbell */ + rdev =pci_get_domain_bus_and_slot (0 ,0 ,PCI_DEVFN (0 ,0 )); +if (rdev->device ==0x1630 ) + _psp_send_i2c_req = psp_send_i2c_req_cezanne; +else + _psp_send_i2c_req = psp_send_i2c_req_doorbell; +pci_dev_put (rdev); +if (psp_check_platform_access_status ())return -EPROBE_DEFER ;
Signature · 1 line
2.34.1
Re: [PATCH v7 6/6] i2c: designware: Add doorbell support for Mendocino
Quoted 24 lines · Mario Limonciello
Mendocino and later platform don't use the platform feature mailbox for communication for I2C arbitration, they rely upon ringing a doorbell.
Detect the platform by the device ID of the root port and choose the appropriate method.
Signed-off-by Mario Limonciello <[email protected]>---
v6->v7:
* Add missingpci_dev_put()
* s/mendocino/doorbell/v5->v6:
* Handle Mendocino busy code like Cezannev4->v5:
* Poll for busy
* Rename to mendocino
* Add explicit dependency on PCIv3->v4:
* Adjust to use PCI device ID and function pointers insteadv2->v3:
* Use CPU ID rather than ACPI ID, this will be pushed to a later patchv1->v2:
* New patch
Quoted 5 lines
--- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-designware-amdpsp.c | 26 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
Re: [PATCH v7 6/6] i2c: designware: Add doorbell support for Mendocino
In reply to Mario Limonciellokernel test robot
build botRe: [PATCH v7 6/6] i2c: designware: Add doorbell support for Mendocino
In reply to Mario LimoncielloThank you for the patch! Yet something to improve:
Hi Mario,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on 9117e682b8b79f7b5e2517fd28d42757d3e8b860]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/crypto-ccp-Drop-extra-doorbell-checks/20230330-060959 base: 9117e682b8b79f7b5e2517fd28d42757d3e8b860 patch link: https://lore.kernel.org/r/20230329220753.7741-7-mario.limonciello%40amd.com patch subject: [PATCH v7 6/6] i2c: designware: Add doorbell support for Mendocino config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230402/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/9696fd5743f2be39fab0ac256fad8dd9eae9930d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mario-Limonciello/crypto-ccp-Drop-extra-doorbell-checks/20230330-060959 git checkout 9696fd5743f2be39fab0ac256fad8dd9eae9930d
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
ld: drivers/i2c/busses/i2c-designware-amdpsp.o: in function `psp_send_i2c_req_doorbell':
>> i2c-designware-amdpsp.c:(.text+0x12): undefined reference to `psp_ring_platform_doorbell'
ld: drivers/i2c/busses/i2c-designware-amdpsp.o: in function `psp_send_i2c_req_cezanne':
i2c-designware-amdpsp.c:(.text+0x67): undefined reference to `psp_send_platform_access_msg'
ld: drivers/i2c/busses/i2c-designware-amdpsp.o: in function `i2c_dw_amdpsp_probe_lock_support':
i2c-designware-amdpsp.c:(.text+0x49d): undefined reference to `psp_check_platform_access_status'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests