[3/4] iommu/vt-d: Remove unused vcmd interfaces
Commit Message
Commit 99b5726b4423 ("iommu: Remove ioasid infrastructure") has removed
ioasid allocation interfaces from the iommu subsystem. As a result, these
vcmd interfaces have become obsolete. Remove them to avoid dead code.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel/pasid.h | 2 --
drivers/iommu/intel/pasid.c | 57 -------------------------------------
2 files changed, 59 deletions(-)
Comments
> From: Lu Baolu <baolu.lu@linux.intel.com>
> Sent: Thursday, November 16, 2023 9:51 AM
>
> Commit 99b5726b4423 ("iommu: Remove ioasid infrastructure") has
> removed
> ioasid allocation interfaces from the iommu subsystem. As a result, these
> vcmd interfaces have become obsolete. Remove them to avoid dead code.
>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
it's a surprise to see some remaining vcmd bits not removed.
with a grep actually there are more (mostly in the header files):
drivers/iommu/intel/debugfs.c: IOMMU_REGSET_ENTRY(VCMD),
drivers/iommu/intel/pasid.h:#define VCMD_CMD_ALLOC 0x1
drivers/iommu/intel/pasid.h:#define VCMD_CMD_FREE 0x2
drivers/iommu/intel/pasid.h:#define VCMD_VRSP_IP 0x1
drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC(e) (((e) & 0xff) >> 1)
drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC_SUCCESS 0
drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC_NO_PASID_AVAIL 16
drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC_INVALID_PASID 16
drivers/iommu/intel/pasid.h:#define VCMD_VRSP_RESULT_PASID(e) (((e) >> 16) & 0xfffff)
drivers/iommu/intel/pasid.h:#define VCMD_CMD_OPERAND(e) ((e) << 16)
drivers/iommu/intel/iommu.h:#define DMAR_VCMD_REG 0xe00 /* Virtual command register */
On 11/16/23 11:21 AM, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@linux.intel.com>
>> Sent: Thursday, November 16, 2023 9:51 AM
>>
>> Commit 99b5726b4423 ("iommu: Remove ioasid infrastructure") has
>> removed
>> ioasid allocation interfaces from the iommu subsystem. As a result, these
>> vcmd interfaces have become obsolete. Remove them to avoid dead code.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>
> it's a surprise to see some remaining vcmd bits not removed.
>
> with a grep actually there are more (mostly in the header files):
>
> drivers/iommu/intel/debugfs.c: IOMMU_REGSET_ENTRY(VCMD),
> drivers/iommu/intel/pasid.h:#define VCMD_CMD_ALLOC 0x1
> drivers/iommu/intel/pasid.h:#define VCMD_CMD_FREE 0x2
> drivers/iommu/intel/pasid.h:#define VCMD_VRSP_IP 0x1
> drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC(e) (((e) & 0xff) >> 1)
> drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC_SUCCESS 0
> drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC_NO_PASID_AVAIL 16
> drivers/iommu/intel/pasid.h:#define VCMD_VRSP_SC_INVALID_PASID 16
> drivers/iommu/intel/pasid.h:#define VCMD_VRSP_RESULT_PASID(e) (((e) >> 16) & 0xfffff)
> drivers/iommu/intel/pasid.h:#define VCMD_CMD_OPERAND(e) ((e) << 16)
> drivers/iommu/intel/iommu.h:#define DMAR_VCMD_REG 0xe00 /* Virtual command register */
>
>
Yeah! I will also remove these bits. Thanks!
Best regards,
baolu
@@ -117,8 +117,6 @@ int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev,
void intel_pasid_tear_down_entry(struct intel_iommu *iommu,
struct device *dev, u32 pasid,
bool fault_ignore);
-int vcmd_alloc_pasid(struct intel_iommu *iommu, u32 *pasid);
-void vcmd_free_pasid(struct intel_iommu *iommu, u32 pasid);
void intel_pasid_setup_page_snoop_control(struct intel_iommu *iommu,
struct device *dev, u32 pasid);
#endif /* __INTEL_PASID_H */
@@ -26,63 +26,6 @@
*/
u32 intel_pasid_max_id = PASID_MAX;
-int vcmd_alloc_pasid(struct intel_iommu *iommu, u32 *pasid)
-{
- unsigned long flags;
- u8 status_code;
- int ret = 0;
- u64 res;
-
- raw_spin_lock_irqsave(&iommu->register_lock, flags);
- dmar_writeq(iommu->reg + DMAR_VCMD_REG, VCMD_CMD_ALLOC);
- IOMMU_WAIT_OP(iommu, DMAR_VCRSP_REG, dmar_readq,
- !(res & VCMD_VRSP_IP), res);
- raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
-
- status_code = VCMD_VRSP_SC(res);
- switch (status_code) {
- case VCMD_VRSP_SC_SUCCESS:
- *pasid = VCMD_VRSP_RESULT_PASID(res);
- break;
- case VCMD_VRSP_SC_NO_PASID_AVAIL:
- pr_info("IOMMU: %s: No PASID available\n", iommu->name);
- ret = -ENOSPC;
- break;
- default:
- ret = -ENODEV;
- pr_warn("IOMMU: %s: Unexpected error code %d\n",
- iommu->name, status_code);
- }
-
- return ret;
-}
-
-void vcmd_free_pasid(struct intel_iommu *iommu, u32 pasid)
-{
- unsigned long flags;
- u8 status_code;
- u64 res;
-
- raw_spin_lock_irqsave(&iommu->register_lock, flags);
- dmar_writeq(iommu->reg + DMAR_VCMD_REG,
- VCMD_CMD_OPERAND(pasid) | VCMD_CMD_FREE);
- IOMMU_WAIT_OP(iommu, DMAR_VCRSP_REG, dmar_readq,
- !(res & VCMD_VRSP_IP), res);
- raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
-
- status_code = VCMD_VRSP_SC(res);
- switch (status_code) {
- case VCMD_VRSP_SC_SUCCESS:
- break;
- case VCMD_VRSP_SC_INVALID_PASID:
- pr_info("IOMMU: %s: Invalid PASID\n", iommu->name);
- break;
- default:
- pr_warn("IOMMU: %s: Unexpected error code %d\n",
- iommu->name, status_code);
- }
-}
-
/*
* Per device pasid table management:
*/