blob: 49cb4f371e61800ead4a33db3055259e9d131b34 [file] [log] [blame]
From 65ca9165e380b30882032558f11867a368fbe402 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
index 0a2eeb82cebde8149c9c9b46bf2d72dfbae132ca..48bfd83922048d00db2afc64f388059692e91f8b 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -51,6 +51,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,
@@ -619,6 +620,7 @@ static struct attribute *pci_dev_attrs[] = {
#endif
&dev_attr_driver_override.attr,
&dev_attr_ari_enabled.attr,
+ &dev_attr_untrusted.attr,
NULL,
};
--
2.38.1.584.g0f3c55d4c2-goog