remove unused powernv code v2
Hi all,
the powerpc powernv port has a fairly large chunk of code that never had any upstream user. We generally strive to not keep dead code around, and this was affirmed at least years Maintainer summit.
Changes since v1:
- reword some commit message
PATCH 1/4 powerpc/powernv: remove the unused pnv_pci_set_p2p function
This function has never been used anywhere in the kernel tree since it was added to the tree. We also now have proper PCIe P2P APIs in the core kernel, and any new P2P support should be using those.
--- arch/powerpc/include/asm/opal.h | 7 -- arch/powerpc/include/asm/pnv-pci.h | 2 - arch/powerpc/platforms/powernv/opal-call.c | 1 - arch/powerpc/platforms/powernv/pci.c | 74 ---------------------- arch/powerpc/platforms/powernv/pci.h | 5 -- 5 files changed, 89 deletions(-)
arch/powerpc/include/asm/opal.h +0 -7
@@ -280,13 +280,6 @@ int64_t opal_xive_allocate_irq(uint32_t chip_id);int64_t opal_xive_free_irq (uint32_t girq);int64_t opal_xive_sync (uint32_t type,uint32_t id);int64_t opal_xive_dump (uint32_t type,uint32_t id); -int64_t opal_xive_get_queue_state (uint64_t vp,uint32_t prio, -__be32 *out_qtoggle, -__be32 *out_qindex); -int64_t opal_xive_set_queue_state (uint64_t vp,uint32_t prio, -uint32_t qtoggle, -uint32_t qindex); -int64_t opal_xive_get_vp_state (uint64_t vp,__be64 *out_w01);int64_t opal_pci_set_p2p (uint64_t phb_init,uint64_t phb_target,uint64_t desc,uint16_t pe_number);
arch/powerpc/include/asm/pnv-pci.h +0 -2
@@ -26,8 +26,6 @@ extern int pnv_pci_get_presence_state(uint64_t id, uint8_t *state);extern int pnv_pci_get_power_state (uint64_t id,uint8_t *state);extern int pnv_pci_set_power_state (uint64_t id,uint8_t state,struct opal_msg *msg); -extern int pnv_pci_set_p2p (struct pci_dev *initiator,struct pci_dev *target, -u64 desc);extern int pnv_pci_enable_tunnel (struct pci_dev *dev,uint64_t *asnind);extern int pnv_pci_disable_tunnel (struct pci_dev *dev);
arch/powerpc/platforms/powernv/opal-call.c +0 -1
@@ -273,7 +273,6 @@ OPAL_CALL(opal_npu_map_lpar, OPAL_NPU_MAP_LPAR);OPAL_CALL (opal_imc_counters_init,OPAL_IMC_COUNTERS_INIT );OPAL_CALL (opal_imc_counters_start,OPAL_IMC_COUNTERS_START );OPAL_CALL (opal_imc_counters_stop,OPAL_IMC_COUNTERS_STOP ); -OPAL_CALL (opal_pci_set_p2p,OPAL_PCI_SET_P2P );OPAL_CALL (opal_get_powercap,OPAL_GET_POWERCAP );OPAL_CALL (opal_set_powercap,OPAL_SET_POWERCAP );OPAL_CALL (opal_get_power_shift_ratio,OPAL_GET_POWER_SHIFT_RATIO );
arch/powerpc/platforms/powernv/pci.c +0 -74
86 lines not on this page · raw message
arch/powerpc/platforms/powernv/pci.h +0 -5
@@ -79,9 +79,6 @@ struct pnv_ioda_pe {struct pnv_ioda_pe *master;struct list_head slaves; -/* PCI peer-to-peer*/ -int p2p_initiator_count; -/* Link in list of PE#s */ struct list_head list; };
@@ -172,8 +169,6 @@ struct pnv_phb {/* PHB and hub diagnostics */ unsigned int diag_data_size;u8 *diag_data; - -int p2p_target_count; };extern struct pci_ops pnv_pci_ops;
Signature · 1 line
2.20.1
Re: [PATCH 1/4] powerpc/powernv: remove the unused pnv_pci_set_p2p function
Hello Christoph,
Quoted 18 lines · Christoph Hellwig
This function has never been used anywhere in the kernel tree since it was added to the tree. We also now have proper PCIe P2P APIs in the core kernel, and any new P2P support should be using those.
Signed-off-by Christoph Hellwig <[email protected]>--- arch/powerpc/include/asm/opal.h | 7 -- arch/powerpc/include/asm/pnv-pci.h | 2 - arch/powerpc/platforms/powernv/opal-call.c | 1 - arch/powerpc/platforms/powernv/pci.c | 74 ---------------------- arch/powerpc/platforms/powernv/pci.h | 5 -- 5 files changed, 89 deletions(-)arch/powerpc/include/asm/opal.h +0
-0
arch/powerpc/include/asm/opal.h int64_t opal_xive_allocate_irq(uint32_t chip_id); · line 289
Quoted 10 lines
arch/powerpc/include/asm/opal.h +0
-7@@ -280,13 +280,6 @@ int64_t opal_xive_allocate_irq(uint32_t chip_id);int64_t opal_xive_free_irq (uint32_t girq);int64_t opal_xive_sync (uint32_t type,uint32_t id);int64_t opal_xive_dump (uint32_t type,uint32_t id); -int64_t opal_xive_get_queue_state (uint64_t vp,uint32_t prio, -__be32 *out_qtoggle, -__be32 *out_qindex); -int64_t opal_xive_set_queue_state (uint64_t vp,uint32_t prio, -uint32_t qtoggle, -uint32_t qindex); -int64_t opal_xive_get_vp_state (uint64_t vp,__be64 *out_w01);
This hunk seems unrelated.
These OPAL calls are new. They are used by the XIVE KVM device to get/set the interrupt controller state of a guest.
arch/powerpc/include/asm/opal.h int64_t opal_xive_allocate_irq(uint32_t chip_id); · line 284
Quoted 2 lines
arch/powerpc/include/asm/opal.h +0
-0int64_t opal_pci_set_p2p (uint64_t phb_init,uint64_t phb_target,uint64_t desc,uint16_t pe_number);
I suppose this is the one ^ you wanted to remove.
Cheers,
C.
Quoted 142 lines
arch/powerpc/include/asm/pnv-pci.h +0
-2@@ -26,8 +26,6 @@ extern int pnv_pci_get_presence_state(uint64_t id, uint8_t *state);extern int pnv_pci_get_power_state (uint64_t id,uint8_t *state);extern int pnv_pci_set_power_state (uint64_t id,uint8_t state,struct opal_msg *msg); -extern int pnv_pci_set_p2p (struct pci_dev *initiator,struct pci_dev *target, -u64 desc);extern int pnv_pci_enable_tunnel (struct pci_dev *dev,uint64_t *asnind);extern int pnv_pci_disable_tunnel (struct pci_dev *dev);arch/powerpc/platforms/powernv/opal-call.c +0
-1@@ -273,7 +273,6 @@ OPAL_CALL(opal_npu_map_lpar, OPAL_NPU_MAP_LPAR);OPAL_CALL (opal_imc_counters_init,OPAL_IMC_COUNTERS_INIT );OPAL_CALL (opal_imc_counters_start,OPAL_IMC_COUNTERS_START );OPAL_CALL (opal_imc_counters_stop,OPAL_IMC_COUNTERS_STOP ); -OPAL_CALL (opal_pci_set_p2p,OPAL_PCI_SET_P2P );OPAL_CALL (opal_get_powercap,OPAL_GET_POWERCAP );OPAL_CALL (opal_set_powercap,OPAL_SET_POWERCAP );OPAL_CALL (opal_get_power_shift_ratio,OPAL_GET_POWER_SHIFT_RATIO );arch/powerpc/platforms/powernv/pci.c +0
-74@@ -38,7 +38,6 @@#include "powernv.h" #include "pci.h" -static DEFINE_MUTEX (p2p_mutex);static DEFINE_MUTEX (tunnel_mutex);int pnv_pci_get_slot_id (struct device_node *np,uint64_t *id)@@ -861,79 +860,6 @@ void pnv_pci_dma_bus_setup(struct pci_bus *bus) } } -int pnv_pci_set_p2p (struct pci_dev *initiator,struct pci_dev *target,u64 desc) -{ -struct pci_controller *hose; -struct pnv_phb *phb_init, *phb_target; -struct pnv_ioda_pe *pe_init; -int rc; - -if (!opal_check_token (OPAL_PCI_SET_P2P )) -return -ENXIO ; - - hose =pci_bus_to_host (initiator->bus); - phb_init = hose->private_data; - - hose =pci_bus_to_host (target->bus); - phb_target = hose->private_data; - - pe_init =pnv_ioda_get_pe (initiator); -if (!pe_init) -return -ENODEV ; - -/* -* Configuring the initiator's PHB requires to adjust its -* TVE#1 setting. Since the same device can be an initiator -* several times for different target devices, we need to keep -* a reference count to know when we can restore the default -* bypass setting on its TVE#1 when disabling. Opal is not -* tracking PE states, so we add a reference count on the PE -* in linux. -* -* For the target, the configuration is per PHB, so we keep a -* target reference count on the PHB. -*/ -mutex_lock (&p2p_mutex); - -if (desc &OPAL_PCI_P2P_ENABLE ) { -/* always go to opal to validate the configuration */ - rc =opal_pci_set_p2p (phb_init->opal_id, phb_target->opal_id, - desc, pe_init->pe_number); - -if (rc !=OPAL_SUCCESS ) { - rc = -EIO ; - goto out; - } - - pe_init->p2p_initiator_count++; - phb_target->p2p_target_count++; - }else { -if (!pe_init->p2p_initiator_count || - !phb_target->p2p_target_count) { - rc = -EINVAL ; - goto out; - } - -if (--pe_init->p2p_initiator_count ==0 ) -pnv_pci_ioda2_set_bypass (pe_init, true); - -if (--phb_target->p2p_target_count ==0 ) { - rc =opal_pci_set_p2p (phb_init->opal_id, - phb_target->opal_id, desc, - pe_init->pe_number); -if (rc !=OPAL_SUCCESS ) { - rc = -EIO ; - goto out; - } - } - } - rc =0 ; -out: -mutex_unlock (&p2p_mutex); -return rc; -} -EXPORT_SYMBOL_GPL (pnv_pci_set_p2p); -struct device_node *pnv_pci_get_phb_node (struct pci_dev *dev) {struct pci_controller *hose =pci_bus_to_host (dev->bus);arch/powerpc/platforms/powernv/pci.h +0
-5@@ -79,9 +79,6 @@ struct pnv_ioda_pe {struct pnv_ioda_pe *master;struct list_head slaves; -/* PCI peer-to-peer*/ -int p2p_initiator_count; -/* Link in list of PE#s */ struct list_head list; };@@ -172,8 +169,6 @@ struct pnv_phb {/* PHB and hub diagnostics */ unsigned int diag_data_size;u8 *diag_data; - -int p2p_target_count; };extern struct pci_ops pnv_pci_ops;
Re: [PATCH 1/4] powerpc/powernv: remove the unused pnv_pci_set_p2p function
Quoted 15 lines · Cédric Le Goater
arch/powerpc/include/asm/opal.h int64_t opal_xive_allocate_irq(uint32_t chip_id); · line 289
Quoted 11 lines
arch/powerpc/include/asm/opal.h +0
-7@@ -280,13 +280,6 @@ int64_t opal_xive_allocate_irq(uint32_t chip_id);int64_t opal_xive_free_irq (uint32_t girq);int64_t opal_xive_sync (uint32_t type,uint32_t id);int64_t opal_xive_dump (uint32_t type,uint32_t id); -int64_t opal_xive_get_queue_state (uint64_t vp,uint32_t prio, -__be32 *out_qtoggle, -__be32 *out_qindex); -int64_t opal_xive_set_queue_state (uint64_t vp,uint32_t prio, -uint32_t qtoggle, -uint32_t qindex); -int64_t opal_xive_get_vp_state (uint64_t vp,__be64 *out_w01);This hunk seems unrelated.
Quoted 8 lines
These OPAL calls are new. They are used by the XIVE KVM device to get/set the interrupt controller state of a guest.
arch/powerpc/include/asm/opal.h int64_t opal_xive_allocate_irq(uint32_t chip_id); · line 284
Quoted 2 lines
arch/powerpc/include/asm/opal.h +0
-0int64_t opal_pci_set_p2p (uint64_t phb_init,uint64_t phb_target,uint64_t desc,uint16_t pe_number);I suppose this is the one ^ you wanted to remove.
Thanks. I'm pretty sure I had this fixed up before due to a builtbot warning, but somehow the old version popped up again.
PATCH 2/4 powerpc/powernv: remove the unused tunneling exports
In reply to Christoph HellwigThese have been unused anywhere in the kernel tree ever since they've been added to the kernel.
--- arch/powerpc/include/asm/pnv-pci.h | 4 -- arch/powerpc/platforms/powernv/pci-ioda.c | 4 +- arch/powerpc/platforms/powernv/pci.c | 71 ----------------------- arch/powerpc/platforms/powernv/pci.h | 1 - 4 files changed, 3 insertions(+), 77 deletions(-)
arch/powerpc/include/asm/pnv-pci.h +0 -4
@@ -27,12 +27,8 @@ extern int pnv_pci_get_power_state(uint64_t id, uint8_t *state);extern int pnv_pci_set_power_state (uint64_t id,uint8_t state,struct opal_msg *msg); -extern int pnv_pci_enable_tunnel (struct pci_dev *dev,uint64_t *asnind); -extern int pnv_pci_disable_tunnel (struct pci_dev *dev);extern int pnv_pci_set_tunnel_bar (struct pci_dev *dev,uint64_t addr,int enable); -extern int pnv_pci_get_as_notify_info (struct task_struct *task,u32 *lpid, -u32 *pid,u32 *tid);int pnv_phb_to_cxl_mode (struct pci_dev *dev,uint64_t mode);int pnv_cxl_ioda_msi_setup (struct pci_dev *dev,unsigned int hwirq,unsigned int virq);
arch/powerpc/platforms/powernv/pci-ioda.c +3 -1
@@ -54,6 +54,8 @@static const char *const pnv_phb_names[] = {"IODA1" ,"IODA2" ,"NPU_NVLINK" ,"NPU_OCAPI" }; +static void pnv_pci_ioda2_set_bypass (struct pnv_ioda_pe *pe,bool enable); +void pe_level_printk (const struct pnv_ioda_pe *pe,const char *level,const char *fmt, ...) {
@@ -2360,7 +2362,7 @@ static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group,return 0 ; } -void pnv_pci_ioda2_set_bypass (struct pnv_ioda_pe *pe,bool enable) +static void pnv_pci_ioda2_set_bypass (struct pnv_ioda_pe *pe,bool enable) {uint16_t window_id = (pe->pe_number <<1 ) +1 ;int64_t rc;
arch/powerpc/platforms/powernv/pci.c +0 -71
83 lines not on this page · raw message
arch/powerpc/platforms/powernv/pci.h +0 -1
@@ -195,7 +195,6 @@ extern int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);extern void pnv_teardown_msi_irqs (struct pci_dev *pdev);extern struct pnv_ioda_pe *pnv_ioda_get_pe (struct pci_dev *dev);extern void pnv_set_msi_irq_chip (struct pnv_phb *phb,unsigned int virq); -extern void pnv_pci_ioda2_set_bypass (struct pnv_ioda_pe *pe,bool enable);extern unsigned long pnv_pci_ioda2_get_table_size (__u32 page_shift,__u64 window_size,__u32 levels);extern int pnv_eeh_post_init (void );
Signature · 1 line
2.20.1
PATCH 3/4 powerpc/powernv: remove unused NPU DMA code
In reply to Christoph HellwigNone of these routines were ever used anywhere in the kernel tree since they were added to the kernel.
--- arch/powerpc/include/asm/book3s/64/mmu.h | 2 - arch/powerpc/include/asm/powernv.h | 22 - arch/powerpc/mm/book3s64/mmu_context.c | 1 - arch/powerpc/platforms/powernv/npu-dma.c | 556 ----------------------- 4 files changed, 581 deletions(-)
arch/powerpc/include/asm/book3s/64/mmu.h +0 -2
@@ -116,8 +116,6 @@ typedef struct {/* Number of users of the external (Nest) MMU */ atomic_t copros; -/* NPU NMMU context */ -struct npu_context *npu_context;struct hash_mm_context *hash_context;unsigned long vdso_base;
arch/powerpc/include/asm/powernv.h +0 -22
@@ -11,35 +11,13 @@#define _ASM_POWERNV_H#ifdef CONFIG_PPC_POWERNV -#define NPU2_WRITE 1extern void powernv_set_nmmu_ptcr (unsigned long ptcr); -extern struct npu_context *pnv_npu2_init_context (struct pci_dev *gpdev, -unsigned long flags, -void (*cb)(struct npu_context *,void *), -void *priv); -extern void pnv_npu2_destroy_context (struct npu_context *context, -struct pci_dev *gpdev); -extern int pnv_npu2_handle_fault (struct npu_context *context,uintptr_t *ea, -unsigned long *flags,unsigned long *status, -int count);void pnv_program_cpu_hotplug_lpcr (unsigned int cpu,u64 lpcr_val);void pnv_tm_init (void );#else static inline void powernv_set_nmmu_ptcr (unsigned long ptcr) { } -static inline struct npu_context *pnv_npu2_init_context (struct pci_dev *gpdev, -unsigned long flags, -struct npu_context *(*cb)(struct npu_context *,void *), -void *priv) {return ERR_PTR (-ENODEV ); } -static inline void pnv_npu2_destroy_context (struct npu_context *context, -struct pci_dev *gpdev) { } - -static inline int pnv_npu2_handle_fault (struct npu_context *context, -uintptr_t *ea,unsigned long *flags, -unsigned long *status,int count) { -return -ENODEV ; -}static inline void pnv_tm_init (void ) { }#endif
arch/powerpc/mm/book3s64/mmu_context.c +0 -1
@@ -140,7 +140,6 @@ static int radix__init_new_context(struct mm_struct *mm)*/ asmvolatile ("ptesync;isync" : : :"memory" ); - mm->context.npu_context =NULL ; mm->context.hash_context =NULL ;return index;
arch/powerpc/platforms/powernv/npu-dma.c +0 -556
594 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 4/4 powerpc/powernv: remove the unused vas_win_paste_addr and vas_win_id functions
In reply to Christoph HellwigThese two function have never been used anywhere in the kernel tree since they were added to the kernel.
--- arch/powerpc/include/asm/vas.h | 10 ---------- arch/powerpc/platforms/powernv/vas-window.c | 19 ------------------- arch/powerpc/platforms/powernv/vas.h | 20 -------------------- 3 files changed, 49 deletions(-)
arch/powerpc/include/asm/vas.h +0 -10
@@ -167,14 +167,4 @@ int vas_copy_crb(void *crb, int offset);*/ int vas_paste_crb (struct vas_window *win,int offset,bool re); -/* -* Return a system-wide unique id for the VAS window @win. -*/ -extern u32 vas_win_id (struct vas_window *win); - -/* -* Return the power bus paste address associated with @win so the caller -* can map that address into their address space. -*/ -extern u64 vas_win_paste_addr (struct vas_window *win);#endif /* __ASM_POWERPC_VAS_H */
arch/powerpc/platforms/powernv/vas-window.c +0 -19
@@ -44,16 +44,6 @@ static void compute_paste_address(struct vas_window *window, u64 *addr, int *lenpr_debug ("Txwin #%d: Paste addr 0x%llx\n" , winid, *addr); } -u64 vas_win_paste_addr (struct vas_window *win) -{ -u64 addr; - -compute_paste_address (win, &addr,NULL ); - -return addr; -} -EXPORT_SYMBOL (vas_win_paste_addr); -static inline void get_hvwc_mmio_bar (struct vas_window *window,u64 *start,int *len) {
@@ -1268,12 +1258,3 @@ int vas_win_close(struct vas_window *window)return 0 ; }EXPORT_SYMBOL_GPL (vas_win_close); - -/* -* Return a system-wide unique window id for the window @win. -*/ -u32 vas_win_id (struct vas_window *win) -{ -return encode_pswid (win->vinst->vas_id, win->winid); -} -EXPORT_SYMBOL_GPL (vas_win_id);
arch/powerpc/platforms/powernv/vas.h +0 -20
@@ -448,26 +448,6 @@ static inline u64 read_hvwc_reg(struct vas_window *win,return in_be64 (win->hvwc_map+reg); } -/* -* Encode/decode the Partition Send Window ID (PSWID) for a window in -* a way that we can uniquely identify any window in the system. i.e. -* we should be able to locate the 'struct vas_window' given the PSWID. -* -* Bits Usage -* 0:7 VAS id (8 bits) -* 8:15 Unused, 0 (3 bits) -* 16:31 Window id (16 bits) -*/ -static inline u32 encode_pswid (int vasid,int winid) -{ -u32 pswid =0 ; - - pswid |= vasid << (31 -7 ); - pswid |= winid; - -return pswid; -} -static inline void decode_pswid (u32 pswid,int *vasid,int *winid) {if (vasid)
Signature · 1 line
2.20.1