Revert "PCI: Allow drivers to request exclusive config regions"
This reverts commit 3108f7c788
which is
commit 278294798ac9118412c9624a801d3f20f2279363 upstream.
It breaks the Android API and is not needed for any Android-specific
platforms, so it can be dropped for now. If it is needed in the future,
it can be brought back in an abi-safe way.
Bug: 161946584
Change-Id: Ic1514e1a760e9ac6bb9da232ea895ab4ce42028b
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
79dd1a60c7
commit
5c4d483e7c
@ -756,13 +756,6 @@ static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (resource_is_exclusive(&dev->driver_exclusive_resource, off,
|
||||
count)) {
|
||||
pci_warn_once(dev, "%s: Unexpected write to kernel-exclusive config offset %llx",
|
||||
current->comm, off);
|
||||
add_taint(TAINT_USER, LOCKDEP_STILL_OK);
|
||||
}
|
||||
|
||||
if (off > dev->cfg_size)
|
||||
return 0;
|
||||
if (off + count > dev->cfg_size) {
|
||||
|
@ -2307,12 +2307,6 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
|
||||
INIT_LIST_HEAD(&dev->bus_list);
|
||||
dev->dev.type = &pci_dev_type;
|
||||
dev->bus = pci_bus_get(bus);
|
||||
dev->driver_exclusive_resource = (struct resource) {
|
||||
.name = "PCI Exclusive",
|
||||
.start = 0,
|
||||
.end = -1,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
raw_spin_lock_init(&dev->msi_lock);
|
||||
#endif
|
||||
|
@ -324,8 +324,6 @@ extern void __devm_release_region(struct device *dev, struct resource *parent,
|
||||
resource_size_t start, resource_size_t n);
|
||||
extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
|
||||
extern bool iomem_is_exclusive(u64 addr);
|
||||
extern bool resource_is_exclusive(struct resource *resource, u64 addr,
|
||||
resource_size_t size);
|
||||
|
||||
extern int
|
||||
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
|
||||
|
@ -410,7 +410,6 @@ struct pci_dev {
|
||||
*/
|
||||
unsigned int irq;
|
||||
struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
|
||||
struct resource driver_exclusive_resource; /* driver exclusive resource ranges */
|
||||
|
||||
bool match_driver; /* Skip attaching driver */
|
||||
|
||||
@ -1433,21 +1432,6 @@ int pci_request_selected_regions(struct pci_dev *, int, const char *);
|
||||
int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
|
||||
void pci_release_selected_regions(struct pci_dev *, int);
|
||||
|
||||
static inline __must_check struct resource *
|
||||
pci_request_config_region_exclusive(struct pci_dev *pdev, unsigned int offset,
|
||||
unsigned int len, const char *name)
|
||||
{
|
||||
return __request_region(&pdev->driver_exclusive_resource, offset, len,
|
||||
name, IORESOURCE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
static inline void pci_release_config_region(struct pci_dev *pdev,
|
||||
unsigned int offset,
|
||||
unsigned int len)
|
||||
{
|
||||
__release_region(&pdev->driver_exclusive_resource, offset, len);
|
||||
}
|
||||
|
||||
/* drivers/pci/bus.c */
|
||||
void pci_add_resource(struct list_head *resources, struct resource *res);
|
||||
void pci_add_resource_offset(struct list_head *resources, struct resource *res,
|
||||
@ -2527,7 +2511,6 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type);
|
||||
#define pci_crit(pdev, fmt, arg...) dev_crit(&(pdev)->dev, fmt, ##arg)
|
||||
#define pci_err(pdev, fmt, arg...) dev_err(&(pdev)->dev, fmt, ##arg)
|
||||
#define pci_warn(pdev, fmt, arg...) dev_warn(&(pdev)->dev, fmt, ##arg)
|
||||
#define pci_warn_once(pdev, fmt, arg...) dev_warn_once(&(pdev)->dev, fmt, ##arg)
|
||||
#define pci_notice(pdev, fmt, arg...) dev_notice(&(pdev)->dev, fmt, ##arg)
|
||||
#define pci_info(pdev, fmt, arg...) dev_info(&(pdev)->dev, fmt, ##arg)
|
||||
#define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg)
|
||||
|
@ -1693,15 +1693,18 @@ static int strict_iomem_checks;
|
||||
*
|
||||
* Returns true if exclusive to the kernel, otherwise returns false.
|
||||
*/
|
||||
bool resource_is_exclusive(struct resource *root, u64 addr, resource_size_t size)
|
||||
bool iomem_is_exclusive(u64 addr)
|
||||
{
|
||||
const unsigned int exclusive_system_ram = IORESOURCE_SYSTEM_RAM |
|
||||
IORESOURCE_EXCLUSIVE;
|
||||
bool skip_children = false, err = false;
|
||||
int size = PAGE_SIZE;
|
||||
struct resource *p;
|
||||
|
||||
addr = addr & PAGE_MASK;
|
||||
|
||||
read_lock(&resource_lock);
|
||||
for_each_resource(root, p, skip_children) {
|
||||
for_each_resource(&iomem_resource, p, skip_children) {
|
||||
if (p->start >= addr + size)
|
||||
break;
|
||||
if (p->end < addr) {
|
||||
@ -1740,12 +1743,6 @@ bool resource_is_exclusive(struct resource *root, u64 addr, resource_size_t size
|
||||
return err;
|
||||
}
|
||||
|
||||
bool iomem_is_exclusive(u64 addr)
|
||||
{
|
||||
return resource_is_exclusive(&iomem_resource, addr & PAGE_MASK,
|
||||
PAGE_SIZE);
|
||||
}
|
||||
|
||||
struct resource_entry *resource_list_create_entry(struct resource *res,
|
||||
size_t extra_size)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user