blob: 48b68bf1c6963e616f13315b31a56d21700b134d [file] [log] [blame]
From c01cecf881779e4355351309e0b1ebc29c402df5 Mon Sep 17 00:00:00 2001
From: Rajat Jain <rajatja@google.com>
Date: Mon, 15 Jun 2020 18:17:42 -0700
Subject: [PATCH] FROMLIST: pci: export untrusted attribute in sysfs
This is needed to allow the userspace to determine when an untrusted
device has been added, and thus allowing it to bind the driver manually
to it, if it so wishes. This is being done as part of the approach
discussed at https://lkml.org/lkml/2020/6/9/1331
Signed-off-by: Rajat Jain <rajatja@google.com>
(am from https://patchwork.kernel.org/patch/11606125/)
(also found at https://lore.kernel.org/r/20200616011742.138975-4-rajatja@google.com)
BUG=b:171541662, b:167448768
TEST=Check that userspace can identify untrusted devices to remove them
on user logoff.
Change-Id: Ie196a410bf227d2fe7ebd55da24e62d175720d9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2511510
Tested-by: Rajat Jain <rajatja@google.com>
Commit-Queue: Rajat Jain <rajatja@google.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
---
drivers/pci/pci-sysfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -50,6 +50,7 @@ pci_config_attr(subsystem_vendor, "0x%04x\n");
pci_config_attr(subsystem_device, "0x%04x\n");
pci_config_attr(revision, "0x%02x\n");
pci_config_attr(class, "0x%06x\n");
+pci_config_attr(untrusted, "%u\n");
static ssize_t irq_show(struct device *dev,
struct device_attribute *attr,
@@ -641,6 +642,7 @@ static struct attribute *pci_dev_attrs[] = {
#endif
&dev_attr_driver_override.attr,
&dev_attr_ari_enabled.attr,
+ &dev_attr_untrusted.attr,
NULL,
};
--
2.34.0.rc2.393.gf8c9666880-goog