device: Add method to configure bus mastering based on Kconfig
commite4a7d9f69347314e7b3110a5f68921da768cb4e8
authorFelix Singer <felix.singer@secunet.com>
Mon, 15 Jun 2020 13:00:56 +0000 (15 15:00 +0200)
committerNico Huber <nico.h@gmx.de>
Mon, 31 Aug 2020 18:34:22 +0000 (31 18:34 +0000)
tree3f51db2e8d0974ed3140b629598786746ec27d25
parent3b72f645132603d8e518abe8651af53b4a732e99
device: Add method to configure bus mastering based on Kconfig

The bus master bit is set at many places in coreboot's code, but the
reason for that is not quite clear. We examined not setting the
bus master bit whereever possible and tried booting without it,
which worked fine for internal PCI devices but not for PCIe. As a PCIe
device we used a Samsung M.2 NVMe SSD.

For security reasons, we would like to disable bus mastering where
possible. Depending on the device, bus mastering might get enabled
by the operating system (e.g. for iGPU) and it might be required for
some devices to work properly. However, the idea is to leave it disabled
and configure the IOMMU first before enabling it.

To have some sort of "backwards compatibility", add a method which
configures bus mastering based on an additional config option. Since
CB:42460 makes usage of this treewide, enable it by default to keep the
current behaviour for now.

Tested with Siemens/Chili, a Coffee Lake based platform.

Change-Id: I876c48ea3fb4f9cf7b6a5c2dcaeda07ea36cbed3
Signed-off-by: Felix Singer <felix.singer@secunet.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42459
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
src/device/Kconfig
src/include/device/pci.h