[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240308133423.0f1ac39e@canb.auug.org.au>
Date: Fri, 8 Mar 2024 13:34:23 +1100
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: Hans de Goede <hdegoede@...hat.com>, Mark Gross <markgross@...nel.org>
Cc: Armin Wolf <W_Armin@....de>, Ilpo Järvinen
<ilpo.jarvinen@...ux.intel.com>, Linux Kernel Mailing List
<linux-kernel@...r.kernel.org>, Linux Next Mailing List
<linux-next@...r.kernel.org>, Mario Limonciello
<mario.limonciello@....com>, Shyam Sundar S K <Shyam-sundar.S-k@....com>
Subject: linux-next: manual merge of the drivers-x86 tree with Linus' tree
Hi all,
Today's linux-next merge of the drivers-x86 tree got a conflict in:
drivers/platform/x86/amd/pmf/tee-if.c
between commits:
3da01394c0f7 ("platform/x86/amd/pmf: Remove smart_pc_status enum")
20545af302bb ("platform/x86/amd/pmf: Add debugging message for missing policy data")
e70961505808 ("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")
from Linus' tree and commits:
6ed210504a18 ("platform/x86/amd/pmf: Add missing __iomem attribute to policy_base")
98cfcece0ab8 ("platform/x86/amd/pmf: Fix return value of amd_pmf_start_policy_engine()")
a87d92223084 ("platform/x86/amd/pmf: Use struct for cookie header")
1e7a14ee259e ("platform/x86/amd/pmf: Fix possible out-of-bound memory accesses")
from the drivers-x86 tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc drivers/platform/x86/amd/pmf/tee-if.c
index dcbe8f85e122,75370431a82e..000000000000
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@@ -246,19 -246,22 +246,24 @@@ static void amd_pmf_invoke_cmd(struct w
static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
{
- u32 cookie, length;
+ struct cookie_header *header;
int res;
- cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET);
- length = readl(dev->policy_buf + POLICY_COOKIE_LEN);
+ if (dev->policy_sz < POLICY_COOKIE_OFFSET + sizeof(*header))
+ return -EINVAL;
- if (cookie != POLICY_SIGN_COOKIE || !length) {
+ header = (struct cookie_header *)(dev->policy_buf + POLICY_COOKIE_OFFSET);
+
- if (header->sign != POLICY_SIGN_COOKIE || !header->length)
++ if (header->sign != POLICY_SIGN_COOKIE || !header->length) {
+ dev_dbg(dev->dev, "cookie doesn't match\n");
return -EINVAL;
+ }
+ if (dev->policy_sz < header->length + 512)
+ return -EINVAL;
+
/* Update the actual length */
- dev->policy_sz = length + 512;
+ dev->policy_sz = header->length + 512;
res = amd_pmf_invoke_cmd_init(dev);
if (res == TA_PMF_TYPE_SUCCESS) {
/* Now its safe to announce that smart pc is enabled */
@@@ -270,8 -273,8 +275,8 @@@
schedule_delayed_work(&dev->pb_work, msecs_to_jiffies(pb_actions_ms * 3));
} else {
dev_err(dev->dev, "ta invoke cmd init failed err: %x\n", res);
- dev->smart_pc_enabled = PMF_SMART_PC_DISABLED;
+ dev->smart_pc_enabled = false;
- return res;
+ return -EIO;
}
return 0;
@@@ -436,46 -458,13 +441,46 @@@ int amd_pmf_init_smart_pc(struct amd_pm
return ret;
INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd);
- amd_pmf_set_dram_addr(dev, true);
- amd_pmf_get_bios_buffer(dev);
- dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
- if (!dev->prev_data)
- return -ENOMEM;
- return dev->smart_pc_enabled;
+ ret = amd_pmf_set_dram_addr(dev, true);
+ if (ret)
+ goto error;
+
+ dev->policy_base = devm_ioremap(dev->dev, dev->policy_addr, dev->policy_sz);
+ if (!dev->policy_base) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ dev->policy_buf = kzalloc(dev->policy_sz, GFP_KERNEL);
+ if (!dev->policy_buf) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
- memcpy(dev->policy_buf, dev->policy_base, dev->policy_sz);
++ memcpy_fromio(dev->policy_buf, dev->policy_base, dev->policy_sz);
+
+ amd_pmf_hex_dump_pb(dev);
+
+ dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
+ if (!dev->prev_data) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ ret = amd_pmf_start_policy_engine(dev);
+ if (ret)
+ goto error;
+
+ if (pb_side_load)
+ amd_pmf_open_pb(dev, dev->dbgfs_dir);
+
+ return 0;
+
+error:
+ amd_pmf_deinit_smart_pc(dev);
+
+ return ret;
}
void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev)
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists