* [PATCH 1/3] PCI/ATS: Remove unused PRI and PASID stubs
2019-10-09 22:53 [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Bjorn Helgaas
@ 2019-10-09 22:53 ` Bjorn Helgaas
2019-10-10 23:07 ` Kuppuswamy Sathyanarayanan
2019-10-09 22:53 ` [PATCH 2/3] PCI/ATS: Remove unnecessary EXPORT_SYMBOL_GPL() Bjorn Helgaas
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2019-10-09 22:53 UTC (permalink / raw)
To: linux-pci
Cc: Kuppuswamy Sathyanarayanan, Ashok Raj, Keith Busch, linux-kernel,
David Woodhouse, Joerg Roedel, iommu, Krzysztof Wilczynski,
Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
The following functions are only used by amd_iommu.c and intel-iommu.c
(when CONFIG_INTEL_IOMMU_SVM is enabled). CONFIG_PCI_PRI and
CONFIG_PCI_PASID are always defined in those cases, so there's no need for
the stubs.
pci_enable_pri()
pci_disable_pri()
pci_reset_pri()
pci_prg_resp_pasid_required()
pci_enable_pasid()
pci_disable_pasid()
Remove the unused stubs.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
include/linux/pci-ats.h | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 67de3a9499bb..963c11f7c56b 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -27,14 +27,7 @@ void pci_restore_pri_state(struct pci_dev *pdev);
int pci_reset_pri(struct pci_dev *pdev);
int pci_prg_resp_pasid_required(struct pci_dev *pdev);
#else /* CONFIG_PCI_PRI */
-static inline int pci_enable_pri(struct pci_dev *pdev, u32 reqs)
-{ return -ENODEV; }
-static inline void pci_disable_pri(struct pci_dev *pdev) { }
static inline void pci_restore_pri_state(struct pci_dev *pdev) { }
-static inline int pci_reset_pri(struct pci_dev *pdev)
-{ return -ENODEV; }
-static inline int pci_prg_resp_pasid_required(struct pci_dev *pdev)
-{ return 0; }
#endif /* CONFIG_PCI_PRI */
#ifdef CONFIG_PCI_PASID
@@ -44,9 +37,6 @@ void pci_restore_pasid_state(struct pci_dev *pdev);
int pci_pasid_features(struct pci_dev *pdev);
int pci_max_pasids(struct pci_dev *pdev);
#else /* CONFIG_PCI_PASID */
-static inline int pci_enable_pasid(struct pci_dev *pdev, int features)
-{ return -EINVAL; }
-static inline void pci_disable_pasid(struct pci_dev *pdev) { }
static inline void pci_restore_pasid_state(struct pci_dev *pdev) { }
static inline int pci_pasid_features(struct pci_dev *pdev)
{ return -EINVAL; }
--
2.23.0.581.g78d2f28ef7-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] PCI/ATS: Remove unused PRI and PASID stubs
2019-10-09 22:53 ` [PATCH 1/3] PCI/ATS: Remove unused PRI and PASID stubs Bjorn Helgaas
@ 2019-10-10 23:07 ` Kuppuswamy Sathyanarayanan
0 siblings, 0 replies; 7+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2019-10-10 23:07 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci
Cc: Ashok Raj, Keith Busch, linux-kernel, David Woodhouse,
Joerg Roedel, iommu, Krzysztof Wilczynski, Bjorn Helgaas
On 10/9/19 3:53 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> The following functions are only used by amd_iommu.c and intel-iommu.c
> (when CONFIG_INTEL_IOMMU_SVM is enabled). CONFIG_PCI_PRI and
> CONFIG_PCI_PASID are always defined in those cases, so there's no need for
> the stubs.
>
> pci_enable_pri()
> pci_disable_pri()
> pci_reset_pri()
> pci_prg_resp_pasid_required()
> pci_enable_pasid()
> pci_disable_pasid()
>
> Remove the unused stubs.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Looks good to me.
Reviewed-by: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>
> ---
> include/linux/pci-ats.h | 10 ----------
> 1 file changed, 10 deletions(-)
>
> diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
> index 67de3a9499bb..963c11f7c56b 100644
> --- a/include/linux/pci-ats.h
> +++ b/include/linux/pci-ats.h
> @@ -27,14 +27,7 @@ void pci_restore_pri_state(struct pci_dev *pdev);
> int pci_reset_pri(struct pci_dev *pdev);
> int pci_prg_resp_pasid_required(struct pci_dev *pdev);
> #else /* CONFIG_PCI_PRI */
> -static inline int pci_enable_pri(struct pci_dev *pdev, u32 reqs)
> -{ return -ENODEV; }
> -static inline void pci_disable_pri(struct pci_dev *pdev) { }
> static inline void pci_restore_pri_state(struct pci_dev *pdev) { }
> -static inline int pci_reset_pri(struct pci_dev *pdev)
> -{ return -ENODEV; }
> -static inline int pci_prg_resp_pasid_required(struct pci_dev *pdev)
> -{ return 0; }
> #endif /* CONFIG_PCI_PRI */
>
> #ifdef CONFIG_PCI_PASID
> @@ -44,9 +37,6 @@ void pci_restore_pasid_state(struct pci_dev *pdev);
> int pci_pasid_features(struct pci_dev *pdev);
> int pci_max_pasids(struct pci_dev *pdev);
> #else /* CONFIG_PCI_PASID */
> -static inline int pci_enable_pasid(struct pci_dev *pdev, int features)
> -{ return -EINVAL; }
> -static inline void pci_disable_pasid(struct pci_dev *pdev) { }
> static inline void pci_restore_pasid_state(struct pci_dev *pdev) { }
> static inline int pci_pasid_features(struct pci_dev *pdev)
> { return -EINVAL; }
--
Sathyanarayanan Kuppuswamy
Linux kernel developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] PCI/ATS: Remove unnecessary EXPORT_SYMBOL_GPL()
2019-10-09 22:53 [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Bjorn Helgaas
2019-10-09 22:53 ` [PATCH 1/3] PCI/ATS: Remove unused PRI and PASID stubs Bjorn Helgaas
@ 2019-10-09 22:53 ` Bjorn Helgaas
2019-10-09 22:53 ` [PATCH 3/3] PCI/ATS: Make pci_restore_pri_state(), pci_restore_pasid_state() private Bjorn Helgaas
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2019-10-09 22:53 UTC (permalink / raw)
To: linux-pci
Cc: Kuppuswamy Sathyanarayanan, Ashok Raj, Keith Busch, linux-kernel,
David Woodhouse, Joerg Roedel, iommu, Krzysztof Wilczynski,
Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
The following functions are only used by the PCI core or by IOMMU drivers
that cannot be modular, so there's no need to export them at all:
pci_enable_ats()
pci_disable_ats()
pci_restore_ats_state()
pci_ats_queue_depth()
pci_ats_page_aligned()
pci_enable_pri()
pci_restore_pri_state()
pci_reset_pri()
pci_prg_resp_pasid_required()
pci_enable_pasid()
pci_disable_pasid()
pci_restore_pasid_state()
pci_pasid_features()
pci_max_pasids()
Remove the unnecessary EXPORT_SYMBOL_GPL()s.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/ats.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index 76ae518d55f4..982b46f0a54d 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -69,7 +69,6 @@ int pci_enable_ats(struct pci_dev *dev, int ps)
dev->ats_enabled = 1;
return 0;
}
-EXPORT_SYMBOL_GPL(pci_enable_ats);
/**
* pci_disable_ats - disable the ATS capability
@@ -88,7 +87,6 @@ void pci_disable_ats(struct pci_dev *dev)
dev->ats_enabled = 0;
}
-EXPORT_SYMBOL_GPL(pci_disable_ats);
void pci_restore_ats_state(struct pci_dev *dev)
{
@@ -102,7 +100,6 @@ void pci_restore_ats_state(struct pci_dev *dev)
ctrl |= PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl);
}
-EXPORT_SYMBOL_GPL(pci_restore_ats_state);
/**
* pci_ats_queue_depth - query the ATS Invalidate Queue Depth
@@ -129,7 +126,6 @@ int pci_ats_queue_depth(struct pci_dev *dev)
pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap);
return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP;
}
-EXPORT_SYMBOL_GPL(pci_ats_queue_depth);
/**
* pci_ats_page_aligned - Return Page Aligned Request bit status.
@@ -156,7 +152,6 @@ int pci_ats_page_aligned(struct pci_dev *pdev)
return 0;
}
-EXPORT_SYMBOL_GPL(pci_ats_page_aligned);
#ifdef CONFIG_PCI_PRI
void pci_pri_init(struct pci_dev *pdev)
@@ -218,7 +213,6 @@ int pci_enable_pri(struct pci_dev *pdev, u32 reqs)
return 0;
}
-EXPORT_SYMBOL_GPL(pci_enable_pri);
/**
* pci_disable_pri - Disable PRI capability
@@ -271,7 +265,6 @@ void pci_restore_pri_state(struct pci_dev *pdev)
pci_write_config_dword(pdev, pri + PCI_PRI_ALLOC_REQ, reqs);
pci_write_config_word(pdev, pri + PCI_PRI_CTRL, control);
}
-EXPORT_SYMBOL_GPL(pci_restore_pri_state);
/**
* pci_reset_pri - Resets device's PRI state
@@ -299,7 +292,6 @@ int pci_reset_pri(struct pci_dev *pdev)
return 0;
}
-EXPORT_SYMBOL_GPL(pci_reset_pri);
/**
* pci_prg_resp_pasid_required - Return PRG Response PASID Required bit
@@ -315,7 +307,6 @@ int pci_prg_resp_pasid_required(struct pci_dev *pdev)
return pdev->pasid_required;
}
-EXPORT_SYMBOL_GPL(pci_prg_resp_pasid_required);
#endif /* CONFIG_PCI_PRI */
#ifdef CONFIG_PCI_PASID
@@ -373,7 +364,6 @@ int pci_enable_pasid(struct pci_dev *pdev, int features)
return 0;
}
-EXPORT_SYMBOL_GPL(pci_enable_pasid);
/**
* pci_disable_pasid - Disable the PASID capability
@@ -398,7 +388,6 @@ void pci_disable_pasid(struct pci_dev *pdev)
pdev->pasid_enabled = 0;
}
-EXPORT_SYMBOL_GPL(pci_disable_pasid);
/**
* pci_restore_pasid_state - Restore PASID capabilities
@@ -421,7 +410,6 @@ void pci_restore_pasid_state(struct pci_dev *pdev)
control = PCI_PASID_CTRL_ENABLE | pdev->pasid_features;
pci_write_config_word(pdev, pasid + PCI_PASID_CTRL, control);
}
-EXPORT_SYMBOL_GPL(pci_restore_pasid_state);
/**
* pci_pasid_features - Check which PASID features are supported
@@ -450,7 +438,6 @@ int pci_pasid_features(struct pci_dev *pdev)
return supported;
}
-EXPORT_SYMBOL_GPL(pci_pasid_features);
#define PASID_NUMBER_SHIFT 8
#define PASID_NUMBER_MASK (0x1f << PASID_NUMBER_SHIFT)
@@ -478,5 +465,4 @@ int pci_max_pasids(struct pci_dev *pdev)
return (1 << supported);
}
-EXPORT_SYMBOL_GPL(pci_max_pasids);
#endif /* CONFIG_PCI_PASID */
--
2.23.0.581.g78d2f28ef7-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] PCI/ATS: Make pci_restore_pri_state(), pci_restore_pasid_state() private
2019-10-09 22:53 [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Bjorn Helgaas
2019-10-09 22:53 ` [PATCH 1/3] PCI/ATS: Remove unused PRI and PASID stubs Bjorn Helgaas
2019-10-09 22:53 ` [PATCH 2/3] PCI/ATS: Remove unnecessary EXPORT_SYMBOL_GPL() Bjorn Helgaas
@ 2019-10-09 22:53 ` Bjorn Helgaas
2019-10-15 11:43 ` [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Joerg Roedel
2019-10-15 21:36 ` Bjorn Helgaas
4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2019-10-09 22:53 UTC (permalink / raw)
To: linux-pci
Cc: Kuppuswamy Sathyanarayanan, Ashok Raj, Keith Busch, linux-kernel,
David Woodhouse, Joerg Roedel, iommu, Krzysztof Wilczynski,
Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
These interfaces:
void pci_restore_pri_state(struct pci_dev *pdev);
void pci_restore_pasid_state(struct pci_dev *pdev);
are only used in drivers/pci and do not need to be seen by the rest of the
kernel. Most them to drivers/pci/pci.h so they're private to the PCI
subsystem.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/pci.h | 4 ++++
include/linux/pci-ats.h | 5 -----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ae84d28ba03a..e6b46d2b9846 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -458,14 +458,18 @@ static inline void pci_restore_ats_state(struct pci_dev *dev) { }
#ifdef CONFIG_PCI_PRI
void pci_pri_init(struct pci_dev *dev);
+void pci_restore_pri_state(struct pci_dev *pdev);
#else
static inline void pci_pri_init(struct pci_dev *dev) { }
+static inline void pci_restore_pri_state(struct pci_dev *pdev) { }
#endif
#ifdef CONFIG_PCI_PASID
void pci_pasid_init(struct pci_dev *dev);
+void pci_restore_pasid_state(struct pci_dev *pdev);
#else
static inline void pci_pasid_init(struct pci_dev *dev) { }
+static inline void pci_restore_pasid_state(struct pci_dev *pdev) { }
#endif
#ifdef CONFIG_PCI_IOV
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 963c11f7c56b..5d62e78946a3 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -23,21 +23,16 @@ static inline int pci_ats_page_aligned(struct pci_dev *dev)
#ifdef CONFIG_PCI_PRI
int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
void pci_disable_pri(struct pci_dev *pdev);
-void pci_restore_pri_state(struct pci_dev *pdev);
int pci_reset_pri(struct pci_dev *pdev);
int pci_prg_resp_pasid_required(struct pci_dev *pdev);
-#else /* CONFIG_PCI_PRI */
-static inline void pci_restore_pri_state(struct pci_dev *pdev) { }
#endif /* CONFIG_PCI_PRI */
#ifdef CONFIG_PCI_PASID
int pci_enable_pasid(struct pci_dev *pdev, int features);
void pci_disable_pasid(struct pci_dev *pdev);
-void pci_restore_pasid_state(struct pci_dev *pdev);
int pci_pasid_features(struct pci_dev *pdev);
int pci_max_pasids(struct pci_dev *pdev);
#else /* CONFIG_PCI_PASID */
-static inline void pci_restore_pasid_state(struct pci_dev *pdev) { }
static inline int pci_pasid_features(struct pci_dev *pdev)
{ return -EINVAL; }
static inline int pci_max_pasids(struct pci_dev *pdev)
--
2.23.0.581.g78d2f28ef7-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports
2019-10-09 22:53 [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Bjorn Helgaas
` (2 preceding siblings ...)
2019-10-09 22:53 ` [PATCH 3/3] PCI/ATS: Make pci_restore_pri_state(), pci_restore_pasid_state() private Bjorn Helgaas
@ 2019-10-15 11:43 ` Joerg Roedel
2019-10-15 21:36 ` Bjorn Helgaas
4 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2019-10-15 11:43 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, Kuppuswamy Sathyanarayanan, Ashok Raj, Keith Busch,
linux-kernel, David Woodhouse, iommu, Krzysztof Wilczynski,
Bjorn Helgaas
Hi Bjorn,
On Wed, Oct 09, 2019 at 05:53:51PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Most of the ATS/PRI/PASID interfaces are only used by IOMMU drivers that
> can only be built statically, not as modules. A couple are only used by
> the PCI core and don't need to be visible outside at all.
>
> These are intended to be cleanup only, but let me know if they would break
> something.
>
> Bjorn Helgaas (3):
> PCI/ATS: Remove unused PRI and PASID stubs
> PCI/ATS: Remove unnecessary EXPORT_SYMBOL_GPL()
> PCI/ATS: Make pci_restore_pri_state(), pci_restore_pasid_state()
> private
The series looks good to me, for the whole series:
Reviewed-by: Joerg Roedel <jroedel@suse.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports
2019-10-09 22:53 [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Bjorn Helgaas
` (3 preceding siblings ...)
2019-10-15 11:43 ` [PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports Joerg Roedel
@ 2019-10-15 21:36 ` Bjorn Helgaas
4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2019-10-15 21:36 UTC (permalink / raw)
To: linux-pci
Cc: Kuppuswamy Sathyanarayanan, Ashok Raj, Keith Busch, linux-kernel,
David Woodhouse, Joerg Roedel, iommu, Krzysztof Wilczynski
On Wed, Oct 09, 2019 at 05:53:51PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Most of the ATS/PRI/PASID interfaces are only used by IOMMU drivers that
> can only be built statically, not as modules. A couple are only used by
> the PCI core and don't need to be visible outside at all.
>
> These are intended to be cleanup only, but let me know if they would break
> something.
>
> Bjorn Helgaas (3):
> PCI/ATS: Remove unused PRI and PASID stubs
> PCI/ATS: Remove unnecessary EXPORT_SYMBOL_GPL()
> PCI/ATS: Make pci_restore_pri_state(), pci_restore_pasid_state()
> private
>
> drivers/pci/ats.c | 14 --------------
> drivers/pci/pci.h | 4 ++++
> include/linux/pci-ats.h | 15 ---------------
> 3 files changed, 4 insertions(+), 29 deletions(-)
I applied these to pci/virtualization for v5.5, with Kuppuswamy's
Reviewed-by on the first and Joerg's on all three. Thank you both for
taking a look!
Bjorn
^ permalink raw reply [flat|nested] 7+ messages in thread