Re: [RFC PATCH] Disable Book-E KVM support?

2022-12-05 Thread Nicholas Piggin
On Sun Dec 4, 2022 at 9:33 PM AEST, Christian Zigotzky wrote:
> Hi All,
>
> We regularly use QEMU with KVM HV on our A-EON AmigaOne X5000 machines 
> (book3e). It works fast and without any problems.
>
> Screenshot tour of QEMU/KVM HV on our AmigaOnes:
>
> - https://i.ibb.co/m4vgwNT/Kernel-6-1-rc3-Power-PC.png
> - https://i.ibb.co/Fwdjf7Z/Kernel-6-0-rc6-Power-PC.png
> - https://i.ibb.co/LYnJGdF/Kernel-5-19-rc5-Power-PC-2.png
> - https://i.ibb.co/vz1Wm5z/QEMU-with-9p-and-USB-sound.png
> - https://i.ibb.co/ScMjtp7/Kernel-5-17-alpha5-Power-PC.png
> - https://i.ibb.co/LQryFcK/Kernel-5-17-alpha4-Power-PC.png
> - https://i.ibb.co/kKLx9mf/Kernel-5-10-89-Power-PC.png
> - https://i.ibb.co/LRG1RDV/Kernel-5-10-89-Power-PC-2.png
> - https://i.ibb.co/NCFqY0k/QEMU-USB-Audio-on-Void-PPC.png
> - https://i.ibb.co/N1vL5Kd/Kernel-5-16-alpha3-Power-PC.png
> - https://i.ibb.co/SwjTyJk/Kernel-5-16-alpha1-Power-PC.png
> - https://i.ibb.co/LkpWNPx/Kernel-5-15-rc5-Power-PC.png
> - https://i.ibb.co/F8q1jDR/Kernel-5-15-rc4-Power-PC.png
> - https://i.ibb.co/zZxrbhV/Kernel-5-15-alpha6-Power-PC.png
> - 
> https://i.pinimg.com/originals/a8/8b/42/a88b422870201887fc01ef44ddc1a235.png
> - 
> https://i.pinimg.com/originals/57/d9/83/57d98324cd055b7ae00a87ad5a45a42f.png
> - 
> https://i.pinimg.com/originals/f2/a5/e3/f2a5e34e2015381b0cb87cc51232a8bc.png
> - 
> https://i.pinimg.com/originals/c5/0d/85/c50d85d7e8f20b4caa1a439faf751964.png
> - 
> https://i.pinimg.com/originals/6e/3b/59/6e3b59fe10276c5644b15622a81f43f1.png
>
> We solved some issues:
>
> - https://forum.hyperion-entertainment.com/viewtopic.php?p=54357#p54357
> - https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-November/236307.html
> - https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-September/249021.html
> - https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-May/229103.html
> - https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-January/223342.html
> - https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216379.html
> - 
> https://forum.hyperion-entertainment.com/viewtopic.php?f=58=4655=53393=KVM#p53393
> - https://forum.hyperion-entertainment.com/viewtopic.php?p=53209#p53209
>
> Please, do not remove KVM support from Book3e because it works without 
> any problems and fast. We need it for our work.

Hey Christian,

I knew you do a lot of testing with BookE, I didn't know you used KVM
there. Good to know it's working for you. In that case I withdraw my
question.

BookE KVM has not been too much trouble, but some things come up that
really need testing before patching, so a QEMU HV implementation would
be good to have (I mean QEMU running the host). mpe has a hardware but
probably no time$ to do much testing (especially of other peoples'
untested patches). So having that would help keep kernel support going.

Thanks,
Nick


Re: [PATCH] cxl: Remove unnecessary cxl_pci_window_alignment()

2022-12-05 Thread Frederic Barrat




On 05/12/2022 23:32, Bjorn Helgaas wrote:

From: Bjorn Helgaas 

cxl_pci_window_alignment() is referenced only via the struct
pci_controller_ops.window_alignment function pointer, and only in the
powerpc implementation of pcibios_window_alignment().

pcibios_window_alignment() defaults to returning 1 if the function pointer
is NULL, which is the same was what cxl_pci_window_alignment() does.

cxl_pci_window_alignment() is unnecessary, so remove it.  No functional
change intended.

Signed-off-by: Bjorn Helgaas 
---



Thanks!
Acked-by: Frederic Barrat 

  Fred



  drivers/misc/cxl/vphb.c | 7 ---
  1 file changed, 7 deletions(-)

diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 1264253cc07b..6332db8044bd 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -67,12 +67,6 @@ static void cxl_pci_disable_device(struct pci_dev *dev)
}
  }
  
-static resource_size_t cxl_pci_window_alignment(struct pci_bus *bus,

-   unsigned long type)
-{
-   return 1;
-}
-
  static void cxl_pci_reset_secondary_bus(struct pci_dev *dev)
  {
/* Should we do an AFU reset here ? */
@@ -200,7 +194,6 @@ static struct pci_controller_ops cxl_pci_controller_ops =
.enable_device_hook = cxl_pci_enable_device_hook,
.disable_device = cxl_pci_disable_device,
.release_device = cxl_pci_disable_device,
-   .window_alignment = cxl_pci_window_alignment,
.reset_secondary_bus = cxl_pci_reset_secondary_bus,
.setup_msi_irqs = cxl_setup_msi_irqs,
.teardown_msi_irqs = cxl_teardown_msi_irqs,


[PATCH] powerpc: qspinlock: Use asm-generic definition for queued_spin_lock

2022-12-05 Thread Rohan McLure
asm-generic/qspinlock.h provides an identical implementation of
queued_spin_lock. Remove the variant in asm/qspinlock.h.

Signed-off-by: Rohan McLure 
---
 arch/powerpc/include/asm/qspinlock.h | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/arch/powerpc/include/asm/qspinlock.h 
b/arch/powerpc/include/asm/qspinlock.h
index b676c4fb90fd..bf5ba0f00258 100644
--- a/arch/powerpc/include/asm/qspinlock.h
+++ b/arch/powerpc/include/asm/qspinlock.h
@@ -33,17 +33,6 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
 extern void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val);
 #endif
 
-static __always_inline void queued_spin_lock(struct qspinlock *lock)
-{
-   u32 val = 0;
-
-   if (likely(arch_atomic_try_cmpxchg_lock(>val, , 
_Q_LOCKED_VAL)))
-   return;
-
-   queued_spin_lock_slowpath(lock, val);
-}
-#define queued_spin_lock queued_spin_lock
-
 #ifdef CONFIG_PARAVIRT_SPINLOCKS
 #define SPIN_THRESHOLD (1<<15) /* not tuned */
 
-- 
2.37.2



Re: [PATCH] powerpc/ftrace: fix syscall tracing on PPC64_ELF_ABI_V1

2022-12-05 Thread Michael Ellerman
Michael Jeanson  writes:
> On 2022-12-05 15:11, Michael Jeanson wrote:
> Michael Jeanson  writes:
>> In v5.7 the powerpc syscall entry/exit logic was rewritten in C, on
>> PPC64_ELF_ABI_V1 this resulted in the symbols in the syscall table
>> changing from their dot prefixed variant to the non-prefixed ones.
>>
>> Since ftrace prefixes a dot to the syscall names when matching them to
>> build its syscall event list, this resulted in no syscall events being
>> available.
>>
>> Remove the PPC64_ELF_ABI_V1 specific version of
>> arch_syscall_match_sym_name to have the same behavior across all powerpc
>> variants.
>
> This doesn't seem to work for me.
>
> Event with it applied I still don't see anything in
> /sys/kernel/debug/tracing/events/syscalls
>
> Did we break it in some other way recently?
>
> cheers
>
> I did some further testing, my config also enabled KALLSYMS_ALL, when I 
> remove 
> it there is indeed no syscall events.

Aha, OK that explains it I guess.

I was using ppc64_guest_defconfig which has ABI_V1 and FTRACE_SYSCALLS,
but does not have KALLSYMS_ALL. So I guess there's some other bug
lurking in there.

cheers


[PATCH] cxl: Remove unnecessary cxl_pci_window_alignment()

2022-12-05 Thread Bjorn Helgaas
From: Bjorn Helgaas 

cxl_pci_window_alignment() is referenced only via the struct
pci_controller_ops.window_alignment function pointer, and only in the
powerpc implementation of pcibios_window_alignment().

pcibios_window_alignment() defaults to returning 1 if the function pointer
is NULL, which is the same was what cxl_pci_window_alignment() does.

cxl_pci_window_alignment() is unnecessary, so remove it.  No functional
change intended.

Signed-off-by: Bjorn Helgaas 
---
 drivers/misc/cxl/vphb.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 1264253cc07b..6332db8044bd 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -67,12 +67,6 @@ static void cxl_pci_disable_device(struct pci_dev *dev)
}
 }
 
-static resource_size_t cxl_pci_window_alignment(struct pci_bus *bus,
-   unsigned long type)
-{
-   return 1;
-}
-
 static void cxl_pci_reset_secondary_bus(struct pci_dev *dev)
 {
/* Should we do an AFU reset here ? */
@@ -200,7 +194,6 @@ static struct pci_controller_ops cxl_pci_controller_ops =
.enable_device_hook = cxl_pci_enable_device_hook,
.disable_device = cxl_pci_disable_device,
.release_device = cxl_pci_disable_device,
-   .window_alignment = cxl_pci_window_alignment,
.reset_secondary_bus = cxl_pci_reset_secondary_bus,
.setup_msi_irqs = cxl_setup_msi_irqs,
.teardown_msi_irqs = cxl_teardown_msi_irqs,
-- 
2.25.1



Re: [PATCH] powerpc/ftrace: fix syscall tracing on PPC64_ELF_ABI_V1

2022-12-05 Thread Michael Jeanson

On 2022-12-05 15:11, Michael Jeanson wrote:

Michael Jeanson  writes:

In v5.7 the powerpc syscall entry/exit logic was rewritten in C, on
PPC64_ELF_ABI_V1 this resulted in the symbols in the syscall table
changing from their dot prefixed variant to the non-prefixed ones.

Since ftrace prefixes a dot to the syscall names when matching them to
build its syscall event list, this resulted in no syscall events being
available.

Remove the PPC64_ELF_ABI_V1 specific version of
arch_syscall_match_sym_name to have the same behavior across all powerpc
variants.


This doesn't seem to work for me.

Event with it applied I still don't see anything in
/sys/kernel/debug/tracing/events/syscalls

Did we break it in some other way recently?

cheers


I did some further testing, my config also enabled KALLSYMS_ALL, when I remove 
it there is indeed no syscall events.




Re: [PATCH v2 31/50] KVM: x86: Do CPU compatibility checks in x86 code

2022-12-05 Thread Sean Christopherson
On Mon, Dec 05, 2022, Isaku Yamahata wrote:
> On Wed, Nov 30, 2022 at 11:09:15PM +,
> > index 66f16458aa97..3571bc968cf8 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -9277,10 +9277,36 @@ static inline void kvm_ops_update(struct 
> > kvm_x86_init_ops *ops)
> > kvm_pmu_ops_update(ops->pmu_ops);
> >  }
> >  
> > +struct kvm_cpu_compat_check {
> > +   struct kvm_x86_init_ops *ops;
> > +   int *ret;
> 
> minor nitpick: just int ret. I don't see the necessity of the pointer.
> Anyway overall it looks good to me.

...

> > @@ -9360,6 +9386,14 @@ static int __kvm_x86_vendor_init(struct 
> > kvm_x86_init_ops *ops)
> > if (r != 0)
> > goto out_mmu_exit;
> >  
> > +   c.ret = 
> > +   c.ops = ops;
> > +   for_each_online_cpu(cpu) {
> > +   smp_call_function_single(cpu, kvm_x86_check_cpu_compat, , 1);
> > +   if (r < 0)
> 
> Here it can be "c.ret < 0".

No, because the below goto leads to "return r", i.e. "c.ret" needs to be 
propagated
to "r".  That's why the code does the admittedly funky "int *ret" thing.

FWIW, this gets cleanup in the end.  "struct kvm_cpu_compat_check" goes away and
"" is passed directly to kvm_x86_check_cpu_compat.

> > +   goto out_hardware_unsetup;


Re: [PATCH v2 39/50] KVM: x86: Move CPU compat checks hook to kvm_x86_ops (from kvm_x86_init_ops)

2022-12-05 Thread Isaku Yamahata
On Wed, Nov 30, 2022 at 11:09:23PM +,
Sean Christopherson  wrote:

> Move the .check_processor_compatibility() callback from kvm_x86_init_ops
> to kvm_x86_ops to allow a future patch to do compatibility checks during
> CPU hotplug.
> 
> Do kvm_ops_update() before compat checks so that static_call() can be
> used during compat checks.
> 
> Signed-off-by: Sean Christopherson 
> ---
>  arch/x86/include/asm/kvm-x86-ops.h |  1 +
>  arch/x86/include/asm/kvm_host.h|  3 ++-
>  arch/x86/kvm/svm/svm.c |  5 +++--
>  arch/x86/kvm/vmx/vmx.c | 16 +++
>  arch/x86/kvm/x86.c | 31 +++---
>  5 files changed, 25 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm-x86-ops.h 
> b/arch/x86/include/asm/kvm-x86-ops.h
> index abccd51dcfca..dba2909e5ae2 100644
> --- a/arch/x86/include/asm/kvm-x86-ops.h
> +++ b/arch/x86/include/asm/kvm-x86-ops.h
> @@ -14,6 +14,7 @@ BUILD_BUG_ON(1)
>   * to make a definition optional, but in this case the default will
>   * be __static_call_return0.
>   */
> +KVM_X86_OP(check_processor_compatibility)
>  KVM_X86_OP(hardware_enable)
>  KVM_X86_OP(hardware_disable)
>  KVM_X86_OP(hardware_unsetup)
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index d79aedf70908..ba74fea6850b 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1518,6 +1518,8 @@ static inline u16 kvm_lapic_irq_dest_mode(bool 
> dest_mode_logical)
>  struct kvm_x86_ops {
>   const char *name;
>  
> + int (*check_processor_compatibility)(void);
> +
>   int (*hardware_enable)(void);
>   void (*hardware_disable)(void);
>   void (*hardware_unsetup)(void);
> @@ -1729,7 +1731,6 @@ struct kvm_x86_nested_ops {
>  };
>  
>  struct kvm_x86_init_ops {
> - int (*check_processor_compatibility)(void);
>   int (*hardware_setup)(void);
>   unsigned int (*handle_intel_pt_intr)(void);
>  
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 9f94efcb9aa6..c2e95c0d9fd8 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -543,7 +543,7 @@ static bool kvm_is_svm_supported(void)
>   return true;
>  }
>  
> -static int __init svm_check_processor_compat(void)
> +static int svm_check_processor_compat(void)
>  {
>   if (!kvm_is_svm_supported())
>   return -EIO;
> @@ -4695,6 +4695,8 @@ static int svm_vm_init(struct kvm *kvm)
>  static struct kvm_x86_ops svm_x86_ops __initdata = {
>   .name = KBUILD_MODNAME,
>  
> + .check_processor_compatibility = svm_check_processor_compat,
> +
>   .hardware_unsetup = svm_hardware_unsetup,
>   .hardware_enable = svm_hardware_enable,
>   .hardware_disable = svm_hardware_disable,
> @@ -5079,7 +5081,6 @@ static __init int svm_hardware_setup(void)
>  
>  static struct kvm_x86_init_ops svm_init_ops __initdata = {
>   .hardware_setup = svm_hardware_setup,
> - .check_processor_compatibility = svm_check_processor_compat,
>  
>   .runtime_ops = _x86_ops,
>   .pmu_ops = _pmu_ops,
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 2a8a6e481c76..6416ed5b7f89 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -2520,8 +2520,7 @@ static bool cpu_has_perf_global_ctrl_bug(void)
>   return false;
>  }
>  
> -static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
> -   u32 msr, u32 *result)
> +static int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, u32 msr, u32 
> *result)
>  {
>   u32 vmx_msr_low, vmx_msr_high;
>   u32 ctl = ctl_min | ctl_opt;
> @@ -2539,7 +2538,7 @@ static __init int adjust_vmx_controls(u32 ctl_min, u32 
> ctl_opt,
>   return 0;
>  }
>  
> -static __init u64 adjust_vmx_controls64(u64 ctl_opt, u32 msr)
> +static u64 adjust_vmx_controls64(u64 ctl_opt, u32 msr)
>  {
>   u64 allowed;
>  
> @@ -2548,8 +2547,8 @@ static __init u64 adjust_vmx_controls64(u64 ctl_opt, 
> u32 msr)
>   return  ctl_opt & allowed;
>  }
>  
> -static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
> - struct vmx_capability *vmx_cap)
> +static int setup_vmcs_config(struct vmcs_config *vmcs_conf,
> +  struct vmx_capability *vmx_cap)
>  {
>   u32 vmx_msr_low, vmx_msr_high;
>   u32 _pin_based_exec_control = 0;
> @@ -2710,7 +2709,7 @@ static __init int setup_vmcs_config(struct vmcs_config 
> *vmcs_conf,
>   return 0;
>  }
>  
> -static bool __init kvm_is_vmx_supported(void)
> +static bool kvm_is_vmx_supported(void)
>  {
>   if (!cpu_has_vmx()) {
>   pr_err("CPU doesn't support VMX\n");
> @@ -2726,7 +2725,7 @@ static bool __init kvm_is_vmx_supported(void)
>   return true;
>  }
>  
> -static int __init vmx_check_processor_compat(void)
> +static int vmx_check_processor_compat(void)
>  {
>   struct vmcs_config vmcs_conf;
>   struct vmx_capability vmx_cap;

Re: [PATCH v2 31/50] KVM: x86: Do CPU compatibility checks in x86 code

2022-12-05 Thread Isaku Yamahata
On Wed, Nov 30, 2022 at 11:09:15PM +,
Sean Christopherson  wrote:

> Move the CPU compatibility checks to pure x86 code, i.e. drop x86's use
> of the common kvm_x86_check_cpu_compat() arch hook.  x86 is the only
> architecture that "needs" to do per-CPU compatibility checks, moving
> the logic to x86 will allow dropping the common code, and will also
> give x86 more control over when/how the compatibility checks are
> performed, e.g. TDX will need to enable hardware (do VMXON) in order to
> perform compatibility checks.
> 
> Signed-off-by: Sean Christopherson 
> ---
>  arch/x86/kvm/svm/svm.c |  2 +-
>  arch/x86/kvm/vmx/vmx.c |  2 +-
>  arch/x86/kvm/x86.c | 49 --
>  3 files changed, 40 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 19e81a99c58f..d7ea1c1175c2 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -5103,7 +5103,7 @@ static int __init svm_init(void)
>* Common KVM initialization _must_ come last, after this, /dev/kvm is
>* exposed to userspace!
>*/
> - r = kvm_init(_init_ops, sizeof(struct vcpu_svm),
> + r = kvm_init(NULL, sizeof(struct vcpu_svm),
>__alignof__(struct vcpu_svm), THIS_MODULE);
>   if (r)
>   goto err_kvm_init;
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 654d81f781da..8deb1bd60c10 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -8592,7 +8592,7 @@ static int __init vmx_init(void)
>* Common KVM initialization _must_ come last, after this, /dev/kvm is
>* exposed to userspace!
>*/
> - r = kvm_init(_init_ops, sizeof(struct vcpu_vmx),
> + r = kvm_init(NULL, sizeof(struct vcpu_vmx),
>__alignof__(struct vcpu_vmx), THIS_MODULE);
>   if (r)
>   goto err_kvm_init;
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 66f16458aa97..3571bc968cf8 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -9277,10 +9277,36 @@ static inline void kvm_ops_update(struct 
> kvm_x86_init_ops *ops)
>   kvm_pmu_ops_update(ops->pmu_ops);
>  }
>  
> +struct kvm_cpu_compat_check {
> + struct kvm_x86_init_ops *ops;
> + int *ret;

minor nitpick: just int ret. I don't see the necessity of the pointer.
Anyway overall it looks good to me.

Reviewed-by: Isaku Yamahata 

> +};
> +
> +static int kvm_x86_check_processor_compatibility(struct kvm_x86_init_ops 
> *ops)
> +{
> + struct cpuinfo_x86 *c = _data(smp_processor_id());
> +
> + WARN_ON(!irqs_disabled());
> +
> + if (__cr4_reserved_bits(cpu_has, c) !=
> + __cr4_reserved_bits(cpu_has, _cpu_data))
> + return -EIO;
> +
> + return ops->check_processor_compatibility();
> +}
> +
> +static void kvm_x86_check_cpu_compat(void *data)
> +{
> + struct kvm_cpu_compat_check *c = data;
> +
> + *c->ret = kvm_x86_check_processor_compatibility(c->ops);
> +}
> +
>  static int __kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
>  {
> + struct kvm_cpu_compat_check c;
>   u64 host_pat;
> - int r;
> + int r, cpu;
>  
>   if (kvm_x86_ops.hardware_enable) {
>   pr_err("kvm: already loaded vendor module '%s'\n", 
> kvm_x86_ops.name);
> @@ -9360,6 +9386,14 @@ static int __kvm_x86_vendor_init(struct 
> kvm_x86_init_ops *ops)
>   if (r != 0)
>   goto out_mmu_exit;
>  
> + c.ret = 
> + c.ops = ops;
> + for_each_online_cpu(cpu) {
> + smp_call_function_single(cpu, kvm_x86_check_cpu_compat, , 1);
> + if (r < 0)

Here it can be "c.ret < 0".

> + goto out_hardware_unsetup;
> + }
> +
>   /*
>* Point of no return!  DO NOT add error paths below this point unless
>* absolutely necessary, as most operations from this point forward
> @@ -9402,6 +9436,8 @@ static int __kvm_x86_vendor_init(struct 
> kvm_x86_init_ops *ops)
>   kvm_init_msr_list();
>   return 0;
>  
> +out_hardware_unsetup:
> + ops->runtime_ops->hardware_unsetup();
>  out_mmu_exit:
>   kvm_mmu_vendor_module_exit();
>  out_free_percpu:
> @@ -12037,16 +12073,7 @@ void kvm_arch_hardware_disable(void)
>  
>  int kvm_arch_check_processor_compat(void *opaque)
>  {
> - struct cpuinfo_x86 *c = _data(smp_processor_id());
> - struct kvm_x86_init_ops *ops = opaque;
> -
> - WARN_ON(!irqs_disabled());
> -
> - if (__cr4_reserved_bits(cpu_has, c) !=
> - __cr4_reserved_bits(cpu_has, _cpu_data))
> - return -EIO;
> -
> - return ops->check_processor_compatibility();
> + return 0;
>  }
>  
>  bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
> -- 
> 2.38.1.584.g0f3c55d4c2-goog
> 

-- 
Isaku Yamahata 


Re: [PATCH 2/5] arm: dts: remove label = "cpu" from DSA dt-binding

2022-12-05 Thread Jernej Škrabec
Dne sreda, 30. november 2022 ob 15:10:37 CET je Arınç ÜNAL napisal(a):
> This is not used by the DSA dt-binding, so remove it from all devicetrees.
> 
> Signed-off-by: Arınç ÜNAL 
> ---
>  arch/arm/boot/dts/armada-370-rd.dts   | 1 -
>  arch/arm/boot/dts/armada-381-netgear-gs110emx.dts | 1 -
>  arch/arm/boot/dts/armada-385-clearfog-gtr-l8.dts  | 1 -
>  arch/arm/boot/dts/armada-385-clearfog-gtr-s4.dts  | 1 -
>  arch/arm/boot/dts/armada-385-linksys.dtsi | 1 -
>  arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 -
>  arch/arm/boot/dts/armada-388-clearfog.dts | 1 -
>  arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 1 -
>  arch/arm/boot/dts/at91-sama5d2_icp.dts| 1 -
>  arch/arm/boot/dts/at91-sama5d3_ksz9477_evb.dts| 1 -
>  arch/arm/boot/dts/bcm-cygnus.dtsi | 1 -
>  arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi | 1 -
>  arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts  | 1 -
>  arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts  | 1 -
>  arch/arm/boot/dts/bcm4708-netgear-r6250.dts   | 1 -
>  arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts | 1 -
>  arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts| 1 -
>  arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 1 -
>  arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 1 -
>  arch/arm/boot/dts/bcm4709-netgear-r8000.dts   | 1 -
>  arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts  | 3 ---
>  arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 1 -
>  arch/arm/boot/dts/bcm47094-linksys-panamera.dts   | 4 
>  arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 1 -
>  arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts | 1 -
>  arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 1 -
>  arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 1 -
>  arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 1 -
>  arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts  | 1 -
>  arch/arm/boot/dts/bcm47189-tenda-ac9.dts  | 1 -
>  arch/arm/boot/dts/bcm53015-meraki-mr26.dts| 1 -
>  arch/arm/boot/dts/bcm53016-meraki-mr32.dts| 1 -
>  arch/arm/boot/dts/bcm953012er.dts | 1 -
>  arch/arm/boot/dts/bcm958622hr.dts | 1 -
>  arch/arm/boot/dts/bcm958623hr.dts | 1 -
>  arch/arm/boot/dts/bcm958625hr.dts | 1 -
>  arch/arm/boot/dts/bcm958625k.dts  | 1 -
>  arch/arm/boot/dts/bcm988312hr.dts | 1 -
>  arch/arm/boot/dts/gemini-dlink-dir-685.dts| 1 -
>  arch/arm/boot/dts/gemini-sl93512r.dts | 1 -
>  arch/arm/boot/dts/gemini-sq201.dts| 1 -
>  arch/arm/boot/dts/imx51-zii-rdu1.dts  | 1 -
>  arch/arm/boot/dts/imx51-zii-scu2-mezz.dts | 1 -
>  arch/arm/boot/dts/imx51-zii-scu3-esb.dts  | 1 -
>  arch/arm/boot/dts/imx53-kp-hsc.dts| 1 -
>  arch/arm/boot/dts/imx6dl-yapp4-common.dtsi| 1 -
>  arch/arm/boot/dts/imx6q-b450v3.dts| 1 -
>  arch/arm/boot/dts/imx6q-b650v3.dts| 1 -
>  arch/arm/boot/dts/imx6q-b850v3.dts| 1 -
>  arch/arm/boot/dts/imx6qdl-gw5904.dtsi | 1 -
>  arch/arm/boot/dts/imx6qdl-skov-cpu.dtsi   | 1 -
>  arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi   | 1 -
>  arch/arm/boot/dts/imx6qp-prtwd3.dts   | 1 -
>  arch/arm/boot/dts/imx7d-zii-rpu2.dts  | 1 -
>  arch/arm/boot/dts/kirkwood-dir665.dts | 1 -
>  arch/arm/boot/dts/kirkwood-l-50.dts   | 1 -
>  arch/arm/boot/dts/kirkwood-linksys-viper.dts  | 1 -
>  arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts| 1 -
>  arch/arm/boot/dts/kirkwood-rd88f6281.dtsi | 1 -
>  arch/arm/boot/dts/mt7623a-rfb-emmc.dts| 1 -
>  arch/arm/boot/dts/mt7623a-rfb-nand.dts| 1 -
>  arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 -
>  arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 1 -
>  arch/arm/boot/dts/orion5x-netgear-wnr854t.dts | 1 -
>  arch/arm/boot/dts/qcom-ipq8064-rb3011.dts | 2 --
>  arch/arm/boot/dts/r9a06g032.dtsi  | 1 -
>  arch/arm/boot/dts/stm32mp151a-prtt1c.dts  | 1 -
>  arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts | 1 -

For sun7i:

Acked-by: Jernej Skrabec 

Best regards,
Jernej

>  arch/arm/boot/dts/vf610-zii-cfu1.dts  | 1 -
>  arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 1 -
>  arch/arm/boot/dts/vf610-zii-dev-rev-c.dts   

Re: [PATCH] powerpc/ftrace: fix syscall tracing on PPC64_ELF_ABI_V1

2022-12-05 Thread Michael Jeanson

On 2022-12-05 13:56, Christophe Leroy wrote:



Le 05/12/2022 à 19:19, Michael Jeanson a écrit :

[Vous ne recevez pas souvent de courriers de mjean...@efficios.com.
Découvrez pourquoi ceci est important à
https://aka.ms/LearnAboutSenderIdentification ]

On 2022-12-05 00:34, Michael Ellerman wrote:

Michael Jeanson  writes:

In v5.7 the powerpc syscall entry/exit logic was rewritten in C, on
PPC64_ELF_ABI_V1 this resulted in the symbols in the syscall table
changing from their dot prefixed variant to the non-prefixed ones.

Since ftrace prefixes a dot to the syscall names when matching them to
build its syscall event list, this resulted in no syscall events being
available.

Remove the PPC64_ELF_ABI_V1 specific version of
arch_syscall_match_sym_name to have the same behavior across all powerpc
variants.


This doesn't seem to work for me.

Event with it applied I still don't see anything in
/sys/kernel/debug/tracing/events/syscalls

Did we break it in some other way recently?

cheers


I've just tried this change on top of v6.1-rc8 in qemu with a base
config of
'corenet32_smp_defconfig' and these options on top:

CONFIG_FTRACE=y
CONFIG_FTRACE_SYSCALLS=y

And I can trace syscalls with ftrace.

What kernel tree and config are you using?


If you are using a ppc32 config, CONFIG_PPC64_ELF_ABI_V1 won't be set,
so it doesn't matter whether this change is there or not.

You should try corenet64_smp_defconfig if you want
CONFIG_PPC64_ELF_ABI_V1 to be set.

You can also use ppc64_defconfig, that's a different platform but it
also has CONFIG_PPC64_ELF_ABI_V1.


You are absolutely right, I used the wrong environment, I blame Monday 
morning. I tested again this time using 'corenet64_smp_defconfig' with the 
same options and syscall tracing with ftrace also works.


I double checked that /proc/config.gz contained CONFIG_PPC64_ELF_ABI_V1 to be 
sure.




Christophe



Thanks for looking into this.





Re: [PATCH 5/5] powerpc: dts: remove label = "cpu" from DSA dt-binding

2022-12-05 Thread Arınç ÜNAL

On 4.12.2022 21:59, Vladimir Oltean wrote:

Hi Pali,

On Fri, Dec 02, 2022 at 08:35:52PM +0100, Pali Rohár wrote:

On Thursday 01 December 2022 17:44:00 Rob Herring wrote:

On Thu, Dec 01, 2022 at 06:39:02PM +0100, Pali Rohár wrote:

I was told by Marek (CCed) that DSA port connected to CPU should have
label "cpu" and not "cpu". Modern way for specifying CPU port is
by defining reference to network device, which there is already (
and ). So that change just "fixed" incorrect naming cpu0 and cpu1.

So probably linux kernel does not need label = "cpu" in DTS anymore. But
this is not the reason to remove this property. Linux kernel does not
use lot of other nodes and properties too... Device tree should describe
hardware and not its usage in Linux. "label" property is valid in device
tree and it exactly describes what or where is this node connected. And
it may be used for other systems.

So I do not see a point in removing "label" properties from turris1x.dts
file, nor from any other dts file.


Well, it seems like a bit of an abuse of 'label' to me. 'label' should
be aligned with a sticker or other identifier identifying something to a
human. Software should never care what the value of 'label' is.


But it already does. "label" property is used for setting (initial)
network interface name for DSA drivers. And you can try to call e.g.
git grep '"cpu"' net/dsa drivers/net/dsa to see that cpu is still
present on some dsa places (probably relict or backward compatibility
before eth reference).


Can you try to eliminate the word "probably" from the information you
transmit and be specific about when did the DSA binding parse or require
the 'label = "cpu"' property for CPU ports in any way?


As Jonas (on CC) pointed out, I only see this being used in the swconfig 
b53 driver which uses the label to identify the cpu port.


https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/generic/files/drivers/net/phy/b53/b53_common.c;h=87d731ec3e2a868dc8389f554b1dc9ab42c30be2;hb=HEAD#l1508

Maybe this got into DSA dt-bindings unchecked before it was decided to 
move forward with DSA instead of swconfig on Linux.


Arınç


Re: [PATCH] powerpc/ftrace: fix syscall tracing on PPC64_ELF_ABI_V1

2022-12-05 Thread Christophe Leroy


Le 05/12/2022 à 19:19, Michael Jeanson a écrit :
> [Vous ne recevez pas souvent de courriers de mjean...@efficios.com. 
> Découvrez pourquoi ceci est important à 
> https://aka.ms/LearnAboutSenderIdentification ]
> 
> On 2022-12-05 00:34, Michael Ellerman wrote:
>> Michael Jeanson  writes:
>>> In v5.7 the powerpc syscall entry/exit logic was rewritten in C, on
>>> PPC64_ELF_ABI_V1 this resulted in the symbols in the syscall table
>>> changing from their dot prefixed variant to the non-prefixed ones.
>>>
>>> Since ftrace prefixes a dot to the syscall names when matching them to
>>> build its syscall event list, this resulted in no syscall events being
>>> available.
>>>
>>> Remove the PPC64_ELF_ABI_V1 specific version of
>>> arch_syscall_match_sym_name to have the same behavior across all powerpc
>>> variants.
>>
>> This doesn't seem to work for me.
>>
>> Event with it applied I still don't see anything in 
>> /sys/kernel/debug/tracing/events/syscalls
>>
>> Did we break it in some other way recently?
>>
>> cheers
> 
> I've just tried this change on top of v6.1-rc8 in qemu with a base 
> config of
> 'corenet32_smp_defconfig' and these options on top:
> 
> CONFIG_FTRACE=y
> CONFIG_FTRACE_SYSCALLS=y
> 
> And I can trace syscalls with ftrace.
> 
> What kernel tree and config are you using?

If you are using a ppc32 config, CONFIG_PPC64_ELF_ABI_V1 won't be set, 
so it doesn't matter whether this change is there or not.

You should try corenet64_smp_defconfig if you want 
CONFIG_PPC64_ELF_ABI_V1 to be set.

You can also use ppc64_defconfig, that's a different platform but it 
also has CONFIG_PPC64_ELF_ABI_V1.

Christophe

> 
> Thanks for looking into this.
> 
>>
>>
>>> Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit 
>>> logic in C")
>>> Cc: sta...@vger.kernel.org # v5.7+
>>> Cc: Steven Rostedt 
>>> Cc: Masami Hiramatsu 
>>> Cc: Mark Rutland 
>>> Cc: Michael Ellerman 
>>> Cc: Nicholas Piggin 
>>> Cc: Christophe Leroy 
>>> Cc: Michal Suchanek 
>>> Cc: linuxppc-dev@lists.ozlabs.org
>>> Cc: linux-ker...@vger.kernel.org
>>> Signed-off-by: Michael Jeanson 
>>> Reviewed-by: Mathieu Desnoyers 
>>> ---
>>>   arch/powerpc/include/asm/ftrace.h | 12 
>>>   1 file changed, 12 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/ftrace.h 
>>> b/arch/powerpc/include/asm/ftrace.h
>>> index 3cee7115441b..e3d1f377bc5b 100644
>>> --- a/arch/powerpc/include/asm/ftrace.h
>>> +++ b/arch/powerpc/include/asm/ftrace.h
>>> @@ -64,17 +64,6 @@ void ftrace_graph_func(unsigned long ip, unsigned 
>>> long parent_ip,
>>>    * those.
>>>    */
>>>   #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
>>> -#ifdef CONFIG_PPC64_ELF_ABI_V1
>>> -static inline bool arch_syscall_match_sym_name(const char *sym, 
>>> const char *name)
>>> -{
>>> -    /* We need to skip past the initial dot, and the __se_sys alias */
>>> -    return !strcmp(sym + 1, name) ||
>>> -    (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, 
>>> name)) ||
>>> -    (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 
>>> 4)) ||
>>> -    (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 
>>> 4)) ||
>>> -    (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 
>>> 4));
>>> -}
>>> -#else
>>>   static inline bool arch_syscall_match_sym_name(const char *sym, 
>>> const char *name)
>>>   {
>>>  return !strcmp(sym, name) ||
>>> @@ -83,7 +72,6 @@ static inline bool 
>>> arch_syscall_match_sym_name(const char *sym, const char *name
>>>  (!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 
>>> 4)) ||
>>>  (!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
>>>   }
>>> -#endif /* CONFIG_PPC64_ELF_ABI_V1 */
>>>   #endif /* CONFIG_FTRACE_SYSCALLS */
>>>
>>>   #if defined(CONFIG_PPC64) && defined(CONFIG_FUNCTION_TRACER)
>>> -- 
>>> 2.34.1
> 


Re: [PATCH] powerpc/ftrace: fix syscall tracing on PPC64_ELF_ABI_V1

2022-12-05 Thread Michael Jeanson

On 2022-12-05 00:34, Michael Ellerman wrote:

Michael Jeanson  writes:

In v5.7 the powerpc syscall entry/exit logic was rewritten in C, on
PPC64_ELF_ABI_V1 this resulted in the symbols in the syscall table
changing from their dot prefixed variant to the non-prefixed ones.

Since ftrace prefixes a dot to the syscall names when matching them to
build its syscall event list, this resulted in no syscall events being
available.

Remove the PPC64_ELF_ABI_V1 specific version of
arch_syscall_match_sym_name to have the same behavior across all powerpc
variants.


This doesn't seem to work for me.

Event with it applied I still don't see anything in 
/sys/kernel/debug/tracing/events/syscalls

Did we break it in some other way recently?

cheers


I've just tried this change on top of v6.1-rc8 in qemu with a base config of 
'corenet32_smp_defconfig' and these options on top:


CONFIG_FTRACE=y
CONFIG_FTRACE_SYSCALLS=y

And I can trace syscalls with ftrace.

What kernel tree and config are you using?

Thanks for looking into this.





Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit logic in 
C")
Cc: sta...@vger.kernel.org # v5.7+
Cc: Steven Rostedt 
Cc: Masami Hiramatsu 
Cc: Mark Rutland 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Michal Suchanek 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-ker...@vger.kernel.org
Signed-off-by: Michael Jeanson 
Reviewed-by: Mathieu Desnoyers 
---
  arch/powerpc/include/asm/ftrace.h | 12 
  1 file changed, 12 deletions(-)

diff --git a/arch/powerpc/include/asm/ftrace.h 
b/arch/powerpc/include/asm/ftrace.h
index 3cee7115441b..e3d1f377bc5b 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -64,17 +64,6 @@ void ftrace_graph_func(unsigned long ip, unsigned long 
parent_ip,
   * those.
   */
  #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
-#ifdef CONFIG_PPC64_ELF_ABI_V1
-static inline bool arch_syscall_match_sym_name(const char *sym, const char 
*name)
-{
-   /* We need to skip past the initial dot, and the __se_sys alias */
-   return !strcmp(sym + 1, name) ||
-   (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
-   (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
-   (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
-   (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
-}
-#else
  static inline bool arch_syscall_match_sym_name(const char *sym, const char 
*name)
  {
return !strcmp(sym, name) ||
@@ -83,7 +72,6 @@ static inline bool arch_syscall_match_sym_name(const char 
*sym, const char *name
(!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
(!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
  }
-#endif /* CONFIG_PPC64_ELF_ABI_V1 */
  #endif /* CONFIG_FTRACE_SYSCALLS */
  
  #if defined(CONFIG_PPC64) && defined(CONFIG_FUNCTION_TRACER)

--
2.34.1




[linux-next:master] BUILD REGRESSION ee9bda616d36d2dc864aa294c2656fad88c9efa0

2022-12-05 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
branch HEAD: ee9bda616d36d2dc864aa294c2656fad88c9efa0  Add linux-next specific 
files for 20221205

Error/Warning reports:

https://lore.kernel.org/oe-kbuild-all/202211242120.mzzvguln-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202211301840.y7rrob13-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212011005.7x5xasmg-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212032205.iehbbyyp-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212051759.cev6fyhy-...@intel.com

Error/Warning: (recently discovered and may have been fixed)

arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't 
find starting instruction
arch/powerpc/kernel/optprobes_head.o: warning: objtool: 
optprobe_template_end(): can't find starting instruction
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn201/irq_service_dcn201.c:40:20: 
warning: no previous prototype for 'to_dal_irq_source_dcn201' 
[-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c:353:5: warning: no previous 
prototype for 'amdgpu_mcbp_scan' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c:373:5: warning: no previous 
prototype for 'amdgpu_mcbp_trigger_preempt' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c:451:1: warning: no previous 
prototype for 'gf100_fifo_nonstall_block' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c:451:1: warning: no previous 
prototype for function 'gf100_fifo_nonstall_block' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c:34:1: warning: no previous 
prototype for 'nvkm_engn_cgrp_get' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c:34:1: warning: no previous 
prototype for function 'nvkm_engn_cgrp_get' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c:210:1: warning: no previous 
prototype for 'tu102_gr_load' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c:210:1: warning: no previous 
prototype for function 'tu102_gr_load' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c:49:1: warning: no previous prototype 
for 'wpr_generic_header_dump' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c:49:1: warning: no previous prototype 
for function 'wpr_generic_header_dump' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c:221:21: warning: variable 'loc' 
set but not used [-Wunused-but-set-variable]
drivers/irqchip/irq-loongarch-cpu.c:96:12: warning: no previous prototype for 
'loongarch_cpu_irq_of_init' [-Wmissing-prototypes]
drivers/regulator/tps65219-regulator.c:310:60: warning: parameter 'dev' set but 
not used [-Wunused-but-set-parameter]
drivers/regulator/tps65219-regulator.c:370:26: sparse:int
drivers/regulator/tps65219-regulator.c:370:26: sparse:struct regulator_dev 
*[assigned] rdev
drivers/regulator/tps65219-regulator.c:370:26: warning: ordered comparison of 
pointer with integer zero [-Wextra]
fs/btrfs/btrfs.o: warning: objtool: __btrfs_map_block+0x1c67: unreachable 
instruction
pahole: .tmp_vmlinux.btf: No such file or directory

Unverified Error/Warning (likely false positive, please contact us if 
interested):

arch/x86/kvm/vmx/hyperv.c:108:9: sparse: sparse: cast truncates bits from 
constant value (1a001a becomes 1a)
arch/x86/kvm/vmx/hyperv.c:110:9: sparse: sparse: cast truncates bits from 
constant value (1a009a becomes 9a)
arch/x86/kvm/vmx/hyperv.c:112:9: sparse: sparse: cast truncates bits from 
constant value (1a011a becomes 11a)
arch/x86/kvm/vmx/hyperv.c:114:9: sparse: sparse: cast truncates bits from 
constant value (1a069a becomes 69a)
arch/x86/kvm/vmx/hyperv.c:116:9: sparse: sparse: cast truncates bits from 
constant value (1b019b becomes 19b)
arch/x86/kvm/vmx/hyperv.c:118:9: sparse: sparse: cast truncates bits from 
constant value (1b021b becomes 21b)
arch/x86/kvm/vmx/hyperv.c:120:9: sparse: sparse: cast truncates bits from 
constant value (1b029b becomes 29b)
arch/x86/kvm/vmx/hyperv.c:122:9: sparse: sparse: cast truncates bits from 
constant value (1b031b becomes 31b)
arch/x86/kvm/vmx/hyperv.c:124:9: sparse: sparse: cast truncates bits from 
constant value (1b039b becomes 39b)
arch/x86/kvm/vmx/hyperv.c:126:9: sparse: sparse: cast truncates bits from 
constant value (1b051b becomes 51b)
arch/x86/kvm/vmx/hyperv.c:130:9: sparse: sparse: cast truncates bits from 
constant value (a048a becomes 48a)
arch/x86/kvm/vmx/hyperv.c:132:9: sparse: sparse: cast truncates bits from 
constant value (80b08 becomes b08)
arch/x86/kvm/vmx/hyperv.c:134:9: sparse: sparse: cast truncates bits from 
constant value (80b88 becomes b88)
arch/x86/kvm/vmx/hyperv.c:136:9: sparse: sparse: cast truncates bits from 
constant value (80c88 becomes c88)
arch/x86/kvm/vmx/hyperv.c:22:9: sparse: sparse: cast truncates bits from 
constant value (1a079a becomes 79a)
arch/x86/kvm/vmx/hyperv.c:24:9: sparse: sparse: cast

[PATCH 1/6] hyperv: Make remove callback of hyperv driver void returned

2022-12-05 Thread Dawei Li
Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for hyperv bus based drivers.

Signed-off-by: Dawei Li 
---
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 4 +---
 drivers/hid/hid-hyperv.c| 4 +---
 drivers/hv/hv_balloon.c | 5 +
 drivers/hv/hv_util.c| 4 +---
 drivers/input/serio/hyperv-keyboard.c   | 4 +---
 drivers/net/hyperv/netvsc_drv.c | 4 +---
 drivers/pci/controller/pci-hyperv.c | 3 +--
 drivers/scsi/storvsc_drv.c  | 4 +---
 drivers/uio/uio_hv_generic.c| 5 ++---
 drivers/video/fbdev/hyperv_fb.c | 5 +
 include/linux/hyperv.h  | 2 +-
 net/vmw_vsock/hyperv_transport.c| 4 +---
 12 files changed, 13 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c 
b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index ca127ff797f7..d117fff26d99 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -165,7 +165,7 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
return ret;
 }
 
-static int hyperv_vmbus_remove(struct hv_device *hdev)
+static void hyperv_vmbus_remove(struct hv_device *hdev)
 {
struct drm_device *dev = hv_get_drvdata(hdev);
struct hyperv_drm_device *hv = to_hv(dev);
@@ -176,8 +176,6 @@ static int hyperv_vmbus_remove(struct hv_device *hdev)
hv_set_drvdata(hdev, NULL);
 
vmbus_free_mmio(hv->mem->start, hv->fb_size);
-
-   return 0;
 }
 
 static int hyperv_vmbus_suspend(struct hv_device *hdev)
diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index ab57b49a44ed..ef16c2a54362 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -535,7 +535,7 @@ static int mousevsc_probe(struct hv_device *device,
 }
 
 
-static int mousevsc_remove(struct hv_device *dev)
+static void mousevsc_remove(struct hv_device *dev)
 {
struct mousevsc_dev *input_dev = hv_get_drvdata(dev);
 
@@ -544,8 +544,6 @@ static int mousevsc_remove(struct hv_device *dev)
hid_hw_stop(input_dev->hid_device);
hid_destroy_device(input_dev->hid_device);
mousevsc_free_device(input_dev);
-
-   return 0;
 }
 
 static int mousevsc_suspend(struct hv_device *dev)
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 6c127f061f06..6bbd2e6fa3d4 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1990,7 +1990,7 @@ static int balloon_probe(struct hv_device *dev,
return ret;
 }
 
-static int balloon_remove(struct hv_device *dev)
+static void balloon_remove(struct hv_device *dev)
 {
struct hv_dynmem_device *dm = hv_get_drvdata(dev);
struct hv_hotadd_state *has, *tmp;
@@ -2031,8 +2031,6 @@ static int balloon_remove(struct hv_device *dev)
kfree(has);
}
spin_unlock_irqrestore(_device.ha_lock, flags);
-
-   return 0;
 }
 
 static int balloon_suspend(struct hv_device *hv_dev)
@@ -2112,7 +2110,6 @@ static  struct hv_driver balloon_drv = {
 
 static int __init init_balloon_drv(void)
 {
-
return vmbus_driver_register(_drv);
 }
 
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 835e6039c186..24995ac41c86 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -602,7 +602,7 @@ static int util_probe(struct hv_device *dev,
return ret;
 }
 
-static int util_remove(struct hv_device *dev)
+static void util_remove(struct hv_device *dev)
 {
struct hv_util_service *srv = hv_get_drvdata(dev);
 
@@ -610,8 +610,6 @@ static int util_remove(struct hv_device *dev)
srv->util_deinit();
vmbus_close(dev->channel);
kfree(srv->recv_buffer);
-
-   return 0;
 }
 
 /*
diff --git a/drivers/input/serio/hyperv-keyboard.c 
b/drivers/input/serio/hyperv-keyboard.c
index d62aefb2e245..31def6ce5157 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -369,7 +369,7 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
return error;
 }
 
-static int hv_kbd_remove(struct hv_device *hv_dev)
+static void hv_kbd_remove(struct hv_device *hv_dev)
 {
struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
 
@@ -378,8 +378,6 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
kfree(kbd_dev);
 
hv_set_drvdata(hv_dev, NULL);
-
-   return 0;
 }
 
 static int hv_kbd_suspend(struct hv_device *hv_dev)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 89eb4f179a3c..50c20e4d4147 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2594,7 +2594,7 @@ static int netvsc_probe(struct hv_device *dev,
return ret;
 }
 
-static int netvsc_remove(struct hv_device *dev)
+static void netvsc_remove(struct 

[PATCH 6/6] soundbus: make remove callback of soundbus driver void returned

2022-12-05 Thread Dawei Li
Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for soundbus based drivers.

Signed-off-by: Dawei Li 
---
 sound/aoa/fabrics/layout.c| 3 +--
 sound/aoa/soundbus/soundbus.h | 6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index ec4ef18555bc..850dc8c53e9b 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -1094,7 +1094,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev 
*sdev)
return -ENODEV;
 }
 
-static int aoa_fabric_layout_remove(struct soundbus_dev *sdev)
+static void aoa_fabric_layout_remove(struct soundbus_dev *sdev)
 {
struct layout_dev *ldev = dev_get_drvdata(>ofdev.dev);
int i;
@@ -1123,7 +1123,6 @@ static int aoa_fabric_layout_remove(struct soundbus_dev 
*sdev)
kfree(ldev);
sdev->pcmid = -1;
sdev->pcmname = NULL;
-   return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
diff --git a/sound/aoa/soundbus/soundbus.h b/sound/aoa/soundbus/soundbus.h
index 3a99c1f1a3ca..230dfa1ba270 100644
--- a/sound/aoa/soundbus/soundbus.h
+++ b/sound/aoa/soundbus/soundbus.h
@@ -184,10 +184,10 @@ struct soundbus_driver {
 
/* we don't implement any matching at all */
 
-   int (*probe)(struct soundbus_dev* dev);
-   int (*remove)(struct soundbus_dev* dev);
+   int (*probe)(struct soundbus_dev *dev);
+   void(*remove)(struct soundbus_dev *dev);
 
-   int (*shutdown)(struct soundbus_dev* dev);
+   int (*shutdown)(struct soundbus_dev *dev);
 
struct device_driver driver;
 };
-- 
2.25.1



[PATCH 5/6] ac97: make remove callback of ac97 driver void returned

2022-12-05 Thread Dawei Li
Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for ac97 bus based drivers.

Signed-off-by: Dawei Li 
---
 drivers/mfd/wm97xx-core.c  | 4 +---
 include/sound/ac97/codec.h | 6 +++---
 sound/ac97/bus.c   | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c
index 9a2331eb1bfa..663acbb1854c 100644
--- a/drivers/mfd/wm97xx-core.c
+++ b/drivers/mfd/wm97xx-core.c
@@ -319,13 +319,11 @@ static int wm97xx_ac97_probe(struct ac97_codec_device 
*adev)
return ret;
 }
 
-static int wm97xx_ac97_remove(struct ac97_codec_device *adev)
+static void wm97xx_ac97_remove(struct ac97_codec_device *adev)
 {
struct wm97xx_priv *wm97xx = ac97_get_drvdata(adev);
 
snd_ac97_compat_release(wm97xx->ac97);
-
-   return 0;
 }
 
 static const struct ac97_id wm97xx_ac97_ids[] = {
diff --git a/include/sound/ac97/codec.h b/include/sound/ac97/codec.h
index 9792d25fa369..a26e9e0082f6 100644
--- a/include/sound/ac97/codec.h
+++ b/include/sound/ac97/codec.h
@@ -62,9 +62,9 @@ struct ac97_codec_device {
  */
 struct ac97_codec_driver {
struct device_driverdriver;
-   int (*probe)(struct ac97_codec_device *);
-   int (*remove)(struct ac97_codec_device *);
-   void(*shutdown)(struct ac97_codec_device *);
+   int (*probe)(struct ac97_codec_device *dev);
+   void(*remove)(struct ac97_codec_device *dev);
+   void(*shutdown)(struct ac97_codec_device *dev);
const struct ac97_id*id_table;
 };
 
diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index 045330883a96..6067c04ce4c0 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -524,10 +524,9 @@ static void ac97_bus_remove(struct device *dev)
if (ret < 0)
return;
 
-   ret = adrv->remove(adev);
+   adrv->remove(adev);
pm_runtime_put_noidle(dev);
-   if (ret == 0)
-   ac97_put_disable_clk(adev);
+   ac97_put_disable_clk(adev);
 
pm_runtime_disable(dev);
 }
-- 
2.25.1



[PATCH 4/6] xen: make remove callback of xen driver void returned

2022-12-05 Thread Dawei Li
Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for xen bus based drivers.

Signed-off-by: Dawei Li 
---
 drivers/block/xen-blkback/xenbus.c  | 4 +---
 drivers/block/xen-blkfront.c| 3 +--
 drivers/char/tpm/xen-tpmfront.c | 3 +--
 drivers/gpu/drm/xen/xen_drm_front.c | 3 +--
 drivers/input/misc/xen-kbdfront.c   | 5 ++---
 drivers/net/xen-netback/xenbus.c| 3 +--
 drivers/net/xen-netfront.c  | 4 +---
 drivers/pci/xen-pcifront.c  | 4 +---
 drivers/scsi/xen-scsifront.c| 4 +---
 drivers/tty/hvc/hvc_xen.c   | 4 ++--
 drivers/usb/host/xen-hcd.c  | 4 +---
 drivers/video/fbdev/xen-fbfront.c   | 6 ++
 drivers/xen/pvcalls-back.c  | 3 +--
 drivers/xen/pvcalls-front.c | 3 +--
 drivers/xen/xen-pciback/xenbus.c| 4 +---
 drivers/xen/xen-scsiback.c  | 4 +---
 include/xen/xenbus.h| 2 +-
 net/9p/trans_xen.c  | 3 +--
 sound/xen/xen_snd_front.c   | 3 +--
 19 files changed, 22 insertions(+), 47 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index c0227dfa4688..4807af1d5805 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -524,7 +524,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, 
blkif_vdev_t handle,
return 0;
 }
 
-static int xen_blkbk_remove(struct xenbus_device *dev)
+static void xen_blkbk_remove(struct xenbus_device *dev)
 {
struct backend_info *be = dev_get_drvdata(>dev);
 
@@ -547,8 +547,6 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
/* Put the reference we set in xen_blkif_alloc(). */
xen_blkif_put(be->blkif);
}
-
-   return 0;
 }
 
 int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt,
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 35b9bcad9db9..e68576ded7cb 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2468,7 +2468,7 @@ static void blkback_changed(struct xenbus_device *dev,
}
 }
 
-static int blkfront_remove(struct xenbus_device *xbdev)
+static void blkfront_remove(struct xenbus_device *xbdev)
 {
struct blkfront_info *info = dev_get_drvdata(>dev);
 
@@ -2489,7 +2489,6 @@ static int blkfront_remove(struct xenbus_device *xbdev)
}
 
kfree(info);
-   return 0;
 }
 
 static int blkfront_is_ready(struct xenbus_device *dev)
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 379291826261..80cca3b83b22 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -360,14 +360,13 @@ static int tpmfront_probe(struct xenbus_device *dev,
return tpm_chip_register(priv->chip);
 }
 
-static int tpmfront_remove(struct xenbus_device *dev)
+static void tpmfront_remove(struct xenbus_device *dev)
 {
struct tpm_chip *chip = dev_get_drvdata(>dev);
struct tpm_private *priv = dev_get_drvdata(>dev);
tpm_chip_unregister(chip);
ring_free(priv);
dev_set_drvdata(>dev, NULL);
-   return 0;
 }
 
 static int tpmfront_resume(struct xenbus_device *dev)
diff --git a/drivers/gpu/drm/xen/xen_drm_front.c 
b/drivers/gpu/drm/xen/xen_drm_front.c
index 0d8e6bd1ccbf..90996c108146 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -717,7 +717,7 @@ static int xen_drv_probe(struct xenbus_device *xb_dev,
return xenbus_switch_state(xb_dev, XenbusStateInitialising);
 }
 
-static int xen_drv_remove(struct xenbus_device *dev)
+static void xen_drv_remove(struct xenbus_device *dev)
 {
struct xen_drm_front_info *front_info = dev_get_drvdata(>dev);
int to = 100;
@@ -751,7 +751,6 @@ static int xen_drv_remove(struct xenbus_device *dev)
 
xen_drm_drv_fini(front_info);
xenbus_frontend_closed(dev);
-   return 0;
 }
 
 static const struct xenbus_device_id xen_driver_ids[] = {
diff --git a/drivers/input/misc/xen-kbdfront.c 
b/drivers/input/misc/xen-kbdfront.c
index 8d8ebdc2039b..67f1c7364c95 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -51,7 +51,7 @@ module_param_array(ptr_size, int, NULL, 0444);
 MODULE_PARM_DESC(ptr_size,
"Pointing device width, height in pixels (default 800,600)");
 
-static int xenkbd_remove(struct xenbus_device *);
+static void xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info 
*);
 static void xenkbd_disconnect_backend(struct xenkbd_info *);
 
@@ -404,7 +404,7 @@ static int xenkbd_resume(struct xenbus_device *dev)
return xenkbd_connect_backend(dev, info);
 }
 
-static int xenkbd_remove(struct xenbus_device *dev)
+static void 

[PATCH 3/6] apr: make remove callback of apr driver void returned

2022-12-05 Thread Dawei Li
Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for apr bus based drivers.

Signed-off-by: Dawei Li 
---
 include/linux/soc/qcom/apr.h  | 2 +-
 sound/soc/qcom/qdsp6/q6core.c | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/soc/qcom/apr.h b/include/linux/soc/qcom/apr.h
index 23c5b30f3511..be98aebcb3e1 100644
--- a/include/linux/soc/qcom/apr.h
+++ b/include/linux/soc/qcom/apr.h
@@ -153,7 +153,7 @@ typedef struct apr_device gpr_device_t;
 
 struct apr_driver {
int (*probe)(struct apr_device *sl);
-   int (*remove)(struct apr_device *sl);
+   void(*remove)(struct apr_device *sl);
int (*callback)(struct apr_device *a,
struct apr_resp_pkt *d);
int (*gpr_callback)(struct gpr_resp_pkt *d, void *data, int op);
diff --git a/sound/soc/qcom/qdsp6/q6core.c b/sound/soc/qcom/qdsp6/q6core.c
index 5358fefd4210..49cfb32cd209 100644
--- a/sound/soc/qcom/qdsp6/q6core.c
+++ b/sound/soc/qcom/qdsp6/q6core.c
@@ -339,7 +339,7 @@ static int q6core_probe(struct apr_device *adev)
return 0;
 }
 
-static int q6core_exit(struct apr_device *adev)
+static void q6core_exit(struct apr_device *adev)
 {
struct q6core *core = dev_get_drvdata(>dev);
 
@@ -350,8 +350,6 @@ static int q6core_exit(struct apr_device *adev)
 
g_core = NULL;
kfree(core);
-
-   return 0;
 }
 
 #ifdef CONFIG_OF
-- 
2.25.1



[PATCH 2/6] macio: Make remove callback of macio driver void returned

2022-12-05 Thread Dawei Li
Commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for macio bus based drivers.

Signed-off-by: Dawei Li 
---
 arch/powerpc/include/asm/macio.h| 12 ++--
 drivers/ata/pata_macio.c|  4 +---
 drivers/macintosh/rack-meter.c  |  4 +---
 drivers/net/ethernet/apple/bmac.c   |  4 +---
 drivers/net/ethernet/apple/mace.c   |  4 +---
 drivers/net/wireless/intersil/orinoco/airport.c |  4 +---
 drivers/scsi/mac53c94.c |  5 +
 drivers/scsi/mesh.c |  5 +
 drivers/tty/serial/pmac_zilog.c |  7 ++-
 sound/aoa/soundbus/i2sbus/core.c|  4 +---
 10 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index ff5fd82d9ff0..f641c730c3b7 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -124,15 +124,15 @@ static inline struct pci_dev *macio_get_pci_dev(struct 
macio_dev *mdev)
  */
 struct macio_driver
 {
-   int (*probe)(struct macio_dev* dev, const struct of_device_id 
*match);
-   int (*remove)(struct macio_dev* dev);
+   int (*probe)(struct macio_dev *dev, const struct of_device_id 
*match);
+   void(*remove)(struct macio_dev *dev);
 
-   int (*suspend)(struct macio_dev* dev, pm_message_t state);
-   int (*resume)(struct macio_dev* dev);
-   int (*shutdown)(struct macio_dev* dev);
+   int (*suspend)(struct macio_dev *dev, pm_message_t state);
+   int (*resume)(struct macio_dev *dev);
+   int (*shutdown)(struct macio_dev *dev);
 
 #ifdef CONFIG_PMAC_MEDIABAY
-   void(*mediabay_event)(struct macio_dev* dev, int mb_state);
+   void(*mediabay_event)(struct macio_dev *dev, int mb_state);
 #endif
struct device_driverdriver;
 };
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index 9ccaac9e2bc3..653106716a4b 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -1187,7 +1187,7 @@ static int pata_macio_attach(struct macio_dev *mdev,
return rc;
 }
 
-static int pata_macio_detach(struct macio_dev *mdev)
+static void pata_macio_detach(struct macio_dev *mdev)
 {
struct ata_host *host = macio_get_drvdata(mdev);
struct pata_macio_priv *priv = host->private_data;
@@ -1202,8 +1202,6 @@ static int pata_macio_detach(struct macio_dev *mdev)
ata_host_detach(host);
 
unlock_media_bay(priv->mdev->media_bay);
-
-   return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index c28893e41a8b..f2f83c4f3af5 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -523,7 +523,7 @@ static int rackmeter_probe(struct macio_dev* mdev,
return rc;
 }
 
-static int rackmeter_remove(struct macio_dev* mdev)
+static void rackmeter_remove(struct macio_dev *mdev)
 {
struct rackmeter *rm = dev_get_drvdata(>ofdev.dev);
 
@@ -558,8 +558,6 @@ static int rackmeter_remove(struct macio_dev* mdev)
 
/* Get rid of me */
kfree(rm);
-
-   return 0;
 }
 
 static int rackmeter_shutdown(struct macio_dev* mdev)
diff --git a/drivers/net/ethernet/apple/bmac.c 
b/drivers/net/ethernet/apple/bmac.c
index 334de0d93c89..8b37ac1cc3d1 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1591,7 +1591,7 @@ bmac_proc_info(char *buffer, char **start, off_t offset, 
int length)
 }
 #endif
 
-static int bmac_remove(struct macio_dev *mdev)
+static void bmac_remove(struct macio_dev *mdev)
 {
struct net_device *dev = macio_get_drvdata(mdev);
struct bmac_data *bp = netdev_priv(dev);
@@ -1609,8 +1609,6 @@ static int bmac_remove(struct macio_dev *mdev)
macio_release_resources(mdev);
 
free_netdev(dev);
-
-   return 0;
 }
 
 static const struct of_device_id bmac_match[] =
diff --git a/drivers/net/ethernet/apple/mace.c 
b/drivers/net/ethernet/apple/mace.c
index d0a771b65e88..b214524a5964 100644
--- a/drivers/net/ethernet/apple/mace.c
+++ b/drivers/net/ethernet/apple/mace.c
@@ -272,7 +272,7 @@ static int mace_probe(struct macio_dev *mdev, const struct 
of_device_id *match)
return rc;
 }
 
-static int mace_remove(struct macio_dev *mdev)
+static void mace_remove(struct macio_dev *mdev)
 {
struct net_device *dev = macio_get_drvdata(mdev);
struct mace_data *mp;
@@ -296,8 +296,6 @@ static int mace_remove(struct macio_dev *mdev)
free_netdev(dev);
 
macio_release_resources(mdev);
-
-   return 0;
 }
 
 static void dbdma_reset(volatile struct dbdma_regs __iomem *dma)
diff --git 

[PATCH 0/6] Make remove() of any bus based driver void returned

2022-12-05 Thread Dawei Li
For bus-based driver, device removal is implemented as:
device_remove() => bus->remove() => driver->remove()

Driver core needs no feedback from bus driver about the result of
remove callback. In which case, commit fc7a6209d571 ("bus: Make
remove callback return void") forces bus_type::remove be void-returned.

Now we have the situation that both 1st & 2nd part of calling chain
are void returned, so it does not make much sense for the last one
(driver->remove) to return non-void to its caller.

So the basic idea behind this patchset is making remove() callback of
any bus-based driver to be void returned.

This patchset includes changes for drivers below:
1. hyperv
2. macio
3. apr
4. xen
5. ac87
6. soundbus

Q: Why not platform drivers?
A: Too many of them.(maybe 4K+)

Dawei Li (6):
  hyperv: Make remove callback of hyperv driver void returned
  macio: Make remove callback of macio driver void returned
  apr: make remove callback of apr driver void returned
  xen: make remove callback of xen driver void returned
  ac97: make remove callback of ac97 driver void returned
  soundbus: make remove callback of soundbus driver void returned

 arch/powerpc/include/asm/macio.h| 12 ++--
 drivers/ata/pata_macio.c|  4 +---
 drivers/block/xen-blkback/xenbus.c  |  4 +---
 drivers/block/xen-blkfront.c|  3 +--
 drivers/char/tpm/xen-tpmfront.c |  3 +--
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c |  4 +---
 drivers/gpu/drm/xen/xen_drm_front.c |  3 +--
 drivers/hid/hid-hyperv.c|  4 +---
 drivers/hv/hv_balloon.c |  5 +
 drivers/hv/hv_util.c|  4 +---
 drivers/input/misc/xen-kbdfront.c   |  5 ++---
 drivers/input/serio/hyperv-keyboard.c   |  4 +---
 drivers/macintosh/rack-meter.c  |  4 +---
 drivers/mfd/wm97xx-core.c   |  4 +---
 drivers/net/ethernet/apple/bmac.c   |  4 +---
 drivers/net/ethernet/apple/mace.c   |  4 +---
 drivers/net/hyperv/netvsc_drv.c |  4 +---
 drivers/net/wireless/intersil/orinoco/airport.c |  4 +---
 drivers/net/xen-netback/xenbus.c|  3 +--
 drivers/net/xen-netfront.c  |  4 +---
 drivers/pci/controller/pci-hyperv.c |  3 +--
 drivers/pci/xen-pcifront.c  |  4 +---
 drivers/scsi/mac53c94.c |  5 +
 drivers/scsi/mesh.c |  5 +
 drivers/scsi/storvsc_drv.c  |  4 +---
 drivers/scsi/xen-scsifront.c|  4 +---
 drivers/tty/hvc/hvc_xen.c   |  4 ++--
 drivers/tty/serial/pmac_zilog.c |  7 ++-
 drivers/uio/uio_hv_generic.c|  5 ++---
 drivers/usb/host/xen-hcd.c  |  4 +---
 drivers/video/fbdev/hyperv_fb.c |  5 +
 drivers/video/fbdev/xen-fbfront.c   |  6 ++
 drivers/xen/pvcalls-back.c  |  3 +--
 drivers/xen/pvcalls-front.c |  3 +--
 drivers/xen/xen-pciback/xenbus.c|  4 +---
 drivers/xen/xen-scsiback.c  |  4 +---
 include/linux/hyperv.h  |  2 +-
 include/linux/soc/qcom/apr.h|  2 +-
 include/sound/ac97/codec.h  |  6 +++---
 include/xen/xenbus.h|  2 +-
 net/9p/trans_xen.c  |  3 +--
 net/vmw_vsock/hyperv_transport.c|  4 +---
 sound/ac97/bus.c|  5 ++---
 sound/aoa/fabrics/layout.c  |  3 +--
 sound/aoa/soundbus/i2sbus/core.c|  4 +---
 sound/aoa/soundbus/soundbus.h   |  6 +++---
 sound/soc/qcom/qdsp6/q6core.c   |  4 +---
 sound/xen/xen_snd_front.c   |  3 +--
 48 files changed, 63 insertions(+), 137 deletions(-)

-- 
2.25.1



[PATCH] ASoC: imx-audmux: use sysfs_emit() to instead of scnprintf()

2022-12-05 Thread ye.xingchen
From: ye xingchen 

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: ye xingchen 
---
 sound/soc/fsl/imx-audmux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index 50b71e5d4589..582f1e2431ee 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -75,8 +75,7 @@ static ssize_t audmux_read_file(struct file *file, char 
__user *user_buf,
if (!buf)
return -ENOMEM;

-   ret = scnprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
-  pdcr, ptcr);
+   ret = sysfs_emit(buf, "PDCR: %08x\nPTCR: %08x\n", pdcr, ptcr);

if (ptcr & IMX_AUDMUX_V2_PTCR_TFSDIR)
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
-- 
2.25.1


Re: [PATCH 2/6] macio: Make remove callback of macio driver void returned

2022-12-05 Thread Greg KH
On Mon, Dec 05, 2022 at 11:36:40PM +0800, Dawei Li wrote:
> Commit fc7a6209d571 ("bus: Make remove callback return
> void") forces bus_type::remove be void-returned, it doesn't
> make much sense for any bus based driver implementing remove
> callbalk to return non-void to its caller.
> 
> This change is for macio bus based drivers.
> 
> Signed-off-by: Dawei Li 
> ---
>  arch/powerpc/include/asm/macio.h| 12 ++--
>  drivers/ata/pata_macio.c|  4 +---
>  drivers/macintosh/rack-meter.c  |  4 +---
>  drivers/net/ethernet/apple/bmac.c   |  4 +---
>  drivers/net/ethernet/apple/mace.c   |  4 +---
>  drivers/net/wireless/intersil/orinoco/airport.c |  4 +---
>  drivers/scsi/mac53c94.c |  5 +
>  drivers/scsi/mesh.c |  5 +
>  drivers/tty/serial/pmac_zilog.c |  7 ++-
>  sound/aoa/soundbus/i2sbus/core.c|  4 +---
>  10 files changed, 16 insertions(+), 37 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/macio.h 
> b/arch/powerpc/include/asm/macio.h
> index ff5fd82d9ff0..f641c730c3b7 100644
> --- a/arch/powerpc/include/asm/macio.h
> +++ b/arch/powerpc/include/asm/macio.h
> @@ -124,15 +124,15 @@ static inline struct pci_dev *macio_get_pci_dev(struct 
> macio_dev *mdev)
>   */
>  struct macio_driver
>  {
> - int (*probe)(struct macio_dev* dev, const struct of_device_id 
> *match);
> - int (*remove)(struct macio_dev* dev);
> + int (*probe)(struct macio_dev *dev, const struct of_device_id 
> *match);
> + void(*remove)(struct macio_dev *dev);

Again, you are changing lines you do not need to here.

thanks,

greg k-h


Re: [PATCH 6/6] soundbus: make remove callback of soundbus driver void returned

2022-12-05 Thread Greg KH
On Mon, Dec 05, 2022 at 11:36:44PM +0800, Dawei Li wrote:
> Since commit fc7a6209d571 ("bus: Make remove callback return
> void") forces bus_type::remove be void-returned, it doesn't
> make much sense for any bus based driver implementing remove
> callbalk to return non-void to its caller.
> 
> This change is for soundbus based drivers.
> 
> Signed-off-by: Dawei Li 
> ---
>  sound/aoa/fabrics/layout.c| 3 +--
>  sound/aoa/soundbus/soundbus.h | 6 +++---
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
> index ec4ef18555bc..850dc8c53e9b 100644
> --- a/sound/aoa/fabrics/layout.c
> +++ b/sound/aoa/fabrics/layout.c
> @@ -1094,7 +1094,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev 
> *sdev)
>   return -ENODEV;
>  }
>  
> -static int aoa_fabric_layout_remove(struct soundbus_dev *sdev)
> +static void aoa_fabric_layout_remove(struct soundbus_dev *sdev)
>  {
>   struct layout_dev *ldev = dev_get_drvdata(>ofdev.dev);
>   int i;
> @@ -1123,7 +1123,6 @@ static int aoa_fabric_layout_remove(struct soundbus_dev 
> *sdev)
>   kfree(ldev);
>   sdev->pcmid = -1;
>   sdev->pcmname = NULL;
> - return 0;
>  }
>  
>  #ifdef CONFIG_PM_SLEEP
> diff --git a/sound/aoa/soundbus/soundbus.h b/sound/aoa/soundbus/soundbus.h
> index 3a99c1f1a3ca..230dfa1ba270 100644
> --- a/sound/aoa/soundbus/soundbus.h
> +++ b/sound/aoa/soundbus/soundbus.h
> @@ -184,10 +184,10 @@ struct soundbus_driver {
>  
>   /* we don't implement any matching at all */
>  
> - int (*probe)(struct soundbus_dev* dev);
> - int (*remove)(struct soundbus_dev* dev);
> + int (*probe)(struct soundbus_dev *dev);

Why change this line too?

thanks,

greg k-h


Re: [PATCH 5/6] ac97: make remove callback of ac97 driver void returned

2022-12-05 Thread Greg KH
On Mon, Dec 05, 2022 at 11:36:43PM +0800, Dawei Li wrote:
> Since commit fc7a6209d571 ("bus: Make remove callback return
> void") forces bus_type::remove be void-returned, it doesn't
> make much sense for any bus based driver implementing remove
> callbalk to return non-void to its caller.
> 
> This change is for ac97 bus based drivers.
> 
> Signed-off-by: Dawei Li 
> ---
>  drivers/mfd/wm97xx-core.c  | 4 +---
>  include/sound/ac97/codec.h | 6 +++---
>  sound/ac97/bus.c   | 5 ++---
>  3 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c
> index 9a2331eb1bfa..663acbb1854c 100644
> --- a/drivers/mfd/wm97xx-core.c
> +++ b/drivers/mfd/wm97xx-core.c
> @@ -319,13 +319,11 @@ static int wm97xx_ac97_probe(struct ac97_codec_device 
> *adev)
>   return ret;
>  }
>  
> -static int wm97xx_ac97_remove(struct ac97_codec_device *adev)
> +static void wm97xx_ac97_remove(struct ac97_codec_device *adev)
>  {
>   struct wm97xx_priv *wm97xx = ac97_get_drvdata(adev);
>  
>   snd_ac97_compat_release(wm97xx->ac97);
> -
> - return 0;
>  }
>  
>  static const struct ac97_id wm97xx_ac97_ids[] = {
> diff --git a/include/sound/ac97/codec.h b/include/sound/ac97/codec.h
> index 9792d25fa369..a26e9e0082f6 100644
> --- a/include/sound/ac97/codec.h
> +++ b/include/sound/ac97/codec.h
> @@ -62,9 +62,9 @@ struct ac97_codec_device {
>   */
>  struct ac97_codec_driver {
>   struct device_driverdriver;
> - int (*probe)(struct ac97_codec_device *);
> - int (*remove)(struct ac97_codec_device *);
> - void(*shutdown)(struct ac97_codec_device *);
> + int (*probe)(struct ac97_codec_device *dev);

Why did you change this line?

> + void(*remove)(struct ac97_codec_device *dev);
> + void(*shutdown)(struct ac97_codec_device *dev);

And this line?

Don't change things that you don't describe in your changelog and that
are not needed for your change.

thanks,

greg k-h


Re: [PATCH 4/6] xen: make remove callback of xen driver void returned

2022-12-05 Thread Greg KH
On Mon, Dec 05, 2022 at 11:36:42PM +0800, Dawei Li wrote:
> Since commit fc7a6209d571 ("bus: Make remove callback return
> void") forces bus_type::remove be void-returned, it doesn't
> make much sense for any bus based driver implementing remove
> callbalk to return non-void to its caller.

Please wrap changelogs at 72 columns.

And this should go through the maintainers of the Xen bus code, not me,
right?

And why wasn't this attached to the 0/6 email properly?  Did you use
different tools?  If so, our tools can't find the link to keep them in
sync either :(

thanks,

greg k-h


Re: [PATCH 0/6] Make remove() of any bus based driver void returned

2022-12-05 Thread Greg KH
On Mon, Dec 05, 2022 at 11:36:38PM +0800, Dawei Li wrote:
> For bus-based driver, device removal is implemented as:
> device_remove() => bus->remove() => driver->remove()
> 
> Driver core needs no feedback from bus driver about the result of
> remove callback. In which case, commit fc7a6209d571 ("bus: Make
> remove callback return void") forces bus_type::remove be void-returned.
> 
> Now we have the situation that both 1st & 2nd part of calling chain
> are void returned, so it does not make much sense for the last one
> (driver->remove) to return non-void to its caller.
> 
> So the basic idea behind this patchset is making remove() callback of
> any bus-based driver to be void returned.
> 
> This patchset includes changes for drivers below:
> 1. hyperv
> 2. macio
> 3. apr
> 4. xen
> 5. ac87
> 6. soundbus

Then that should be 6 different patchsets going to 6 different
subsystems.  No need to make this seems like a unified set of patches at
all.

> Q: Why not platform drivers?
> A: Too many of them.(maybe 4K+)

That will have to be done eventually, right?

thanks,

greg k-h


Re: [PATCH 4/6] xen: make remove callback of xen driver void returned

2022-12-05 Thread Juergen Gross

On 05.12.22 16:36, Dawei Li wrote:

Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

This change is for xen bus based drivers.

Signed-off-by: Dawei Li 


Acked-by: Juergen Gross 


Juergen



OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [V3] tools/perf: Fix printing field separator in CSV metrics output

2022-12-05 Thread Arnaldo Carvalho de Melo
Em Mon, Dec 05, 2022 at 09:58:52AM +0530, Athira Rajeev escreveu:
> In perf stat with CSV output option, number of fields
> in metrics output is not matching with number of fields
> in other event output lines.
> 
> Sample output below after applying patch to fix
> printing os->prefix.
> 
>   # ./perf stat -x, --per-socket -a -C 1 ls
>   S0,1,82.11,msec,cpu-clock,82111626,100.00,1.000,CPUs utilized
>   S0,1,2,,context-switches,82109314,100.00,24.358,/sec
>   --
> > S0,1,,,1.71,stalled cycles per insn

Thanks, tested and applied.

- Arnaldo
 
> The above command line uses field separator as ","
> via "-x," option and per-socket option displays
> socket value as first field. But here the last line
> for "stalled cycles per insn" has more separators.
> Each csv output line is expected to have 8 field
> separators (for the 9 fields), where as last line
> has 9 "," in the result. Patch fixes this issue.
> 
> The counter stats are displayed by function
> "perf_stat__print_shadow_stats" in code
> "util/stat-shadow.c". While printing the stats info
> for "stalled cycles per insn", function "new_line_csv"
> is used as new_line callback.
> 
> The fields printed in each line contains:
> "Socket_id,aggr nr,Avg,unit,event_name,run,enable_percent,ratio,unit"
> 
> The metric output prints Socket_id, aggr nr, ratio
> and unit. It has to skip through remaining five fields
> ie, Avg,unit,event_name,run,enable_percent. The csv
> line callback uses "os->nfields" to know the number of
> fields to skip to match with other lines.
> Currently it is set as:
>   os.nfields = 3 + aggr_fields[config->aggr_mode] + (counter->cgrp ? 1 : 
> 0);
> 
> But in case of aggregation modes, csv_sep already
> gets printed along with each field (Function "aggr_printout"
> in util/stat-display.c). So aggr_fields can be
> removed from nfields. And fixed number of fields to
> skip has to be "4". This is to skip fields for:
> "avg, unit, event name, run, enable_percent"
> 
> This needs 4 csv separators. Patch removes aggr_fields
> and uses 4 as fixed number of os->nfields to skip.
> 
> After the patch:
> 
>   # ./perf stat -x, --per-socket -a -C 1 ls
>   S0,1,79.08,msec,cpu-clock,79085956,100.00,1.000,CPUs utilized
>   S0,1,7,,context-switches,79084176,100.00,88.514,/sec
>   --
> > S0,1,,0.81,stalled cycles per insn
> 
> Fixes: 92a61f6412d3 ("perf stat: Implement CSV metrics output")
> Reported-by: Disha Goel 
> Reviewed-by: Kajol Jain 
> Tested-by: Disha Goel
> Signed-off-by: Athira Rajeev 
> ---
> Changelog:
> v2 -> v3:
> - Rebased on top of tmp.perf/core
> 
> v1 -> v2:
> - Rebased on top of latest source.
> - Added Reviewed-by and Tested-by from Kajol and
>   Disha.
> 
>  tools/perf/util/stat-display.c | 13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index f1ee4b052198..4e9696f4096f 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -686,20 +686,9 @@ static void printout(struct perf_stat_config *config, 
> struct outstate *os,
>   struct evsel *counter = os->evsel;
>  
>   if (config->csv_output) {
> - static const int aggr_fields[AGGR_MAX] = {
> - [AGGR_NONE] = 1,
> - [AGGR_GLOBAL] = 0,
> - [AGGR_SOCKET] = 2,
> - [AGGR_DIE] = 2,
> - [AGGR_CORE] = 2,
> - [AGGR_THREAD] = 1,
> - [AGGR_UNSET] = 0,
> - [AGGR_NODE] = 1,
> - };
> -
>   pm = config->metric_only ? print_metric_only_csv : 
> print_metric_csv;
>   nl = config->metric_only ? new_line_metric : new_line_csv;
> - os->nfields = 3 + aggr_fields[config->aggr_mode] + 
> (counter->cgrp ? 1 : 0);
> + os->nfields = 4 + (counter->cgrp ? 1 : 0);
>   } else if (config->json_output) {
>   pm = config->metric_only ? print_metric_only_json : 
> print_metric_json;
>   nl = config->metric_only ? new_line_metric : new_line_json;
> -- 
> 2.31.1

-- 

- Arnaldo


Re: [PATCH v2] soc: fsl: qe: request pins non-exclusively

2022-12-05 Thread Andy Shevchenko
On Sun, Dec 04, 2022 at 03:59:29PM -0800, Dmitry Torokhov wrote:
> Commit 84582f9ed090 ("soc: fsl: qe: Avoid using gpio_to_desc()") changed
> qe_pin_request() to request and hold GPIO corresponding to a given pin.
> Unfortunately this does not work, as fhci-hcd requests these GPIOs
> first, befor calling qe_pin_request() (see

before ?

> drivers/usb/host/fhci-hcd.c::of_fhci_probe()).
> To fix it change qe_pin_request() to request GPIOs non-exclusively, and
> free them once the code determines GPIO controller and offset for each
> GPIO/pin.
> 
> Also reaching deep into gpiolib implementation is not the best idea. We
> should either export gpio_chip_hwgpio() or keep converting to the global
> gpio numbers space until we fix the driver to implement proper pin

GPIO number

> control.

With or without being rebased on top of the PR that in conflict with this
change,
Reviewed-by: Andy Shevchenko 
(see some nit-picks below)

> Fixes: 84582f9ed090 ("soc: fsl: qe: Avoid using gpio_to_desc()")
> Signed-off-by: Dmitry Torokhov 
> ---
> 
> v2:
> 
>  - rebased on top of soc/driver. This will conflict with
>c9eb6e546a23 soc: fsl: qe: Switch to use fwnode instead of of_node
>found in next, the resolution is trivial: accept
>fwnode_device_is_compatible() line found in next.
>  - fixed leak of gpiod when gc is not found
>  - dropped Linus' reviewed-by as the patch changed
> 
>  drivers/soc/fsl/qe/gpio.c   | 51 +
>  drivers/usb/host/fhci-hcd.c |  2 +-
>  include/soc/fsl/qe/qe.h |  5 ++--
>  3 files changed, 28 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c
> index af9193e7e49b..1440922341d8 100644
> --- a/drivers/soc/fsl/qe/gpio.c
> +++ b/drivers/soc/fsl/qe/gpio.c
> @@ -13,19 +13,12 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include/* for of_mm_gpio_chip */
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> -/*
> - * FIXME: this is legacy code that is accessing gpiolib internals in order
> - * to implement a custom pin controller. The proper solution is to create
> - * a real combined pin control and GPIO driver in drivers/pinctrl. However
> - * this hack is here for legacy code reasons.
> - */
> -#include "../../../gpio/gpiolib.h"
>  
>  struct qe_gpio_chip {
>   struct of_mm_gpio_chip mm_gc;
> @@ -147,65 +140,70 @@ struct qe_pin {
>* something like qe_pio_controller. Someday.
>*/
>   struct qe_gpio_chip *controller;
> - struct gpio_desc *gpiod;
>   int num;
>  };
>  
>  /**
>   * qe_pin_request - Request a QE pin
> - * @np:  device node to get a pin from
> - * @index:   index of a pin in the device tree
> + * @dev: device to get the pin from
> + * @index:   index of the pin in the device tree
>   * Context:  non-atomic
>   *
>   * This function return qe_pin so that you could use it with the rest of
>   * the QE Pin Multiplexing API.
>   */
> -struct qe_pin *qe_pin_request(struct device_node *np, int index)
> +struct qe_pin *qe_pin_request(struct device *dev, int index)
>  {
>   struct qe_pin *qe_pin;
>   struct gpio_chip *gc;
>   struct gpio_desc *gpiod;
> + int gpio_num;
>   int err;
>  
>   qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL);
>   if (!qe_pin) {
> - pr_debug("%s: can't allocate memory\n", __func__);
> + dev_dbg(dev, "%s: can't allocate memory\n", __func__);
>   return ERR_PTR(-ENOMEM);
>   }
>  
> - gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), NULL, index, 
> GPIOD_ASIS, "qe");
> - if (IS_ERR(gpiod)) {
> - err = PTR_ERR(gpiod);
> - goto err0;
> - }
> - if (!gpiod) {
> - err = -EINVAL;
> + /*
> +  * Request gpio as nonexclusive as it was likely reserved by the

GPIO

> +  * caller, and we are not planning on controlling it, we only need
> +  * the descriptor to the to the gpio chip structure.

GPIO

> +  */
> + gpiod = gpiod_get_index(dev, NULL, index,
> + GPIOD_ASIS | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
> + err = PTR_ERR_OR_ZERO(gpiod);
> + if (err)
>   goto err0;
> - }
> +
>   gc = gpiod_to_chip(gpiod);
> + gpio_num = desc_to_gpio(gpiod);
> + /* We no longer need this descriptor */
> + gpiod_put(gpiod);
> +
>   if (WARN_ON(!gc)) {
>   err = -ENODEV;
>   goto err0;
>   }
> - qe_pin->gpiod = gpiod;
> +
>   qe_pin->controller = gpiochip_get_data(gc);
>   /*
>* FIXME: this gets the local offset on the gpio_chip so that the driver
>* can manipulate pin control settings through its custom API. The real
>* solution is to create a real pin control driver for this.
>*/
> - qe_pin->num = gpio_chip_hwgpio(gpiod);
> + qe_pin->num = gpio_num - gc->base;
>  
>   if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) 

Re: [RESEND PATCH] soc: fsl: qe: request pins non-exclusively

2022-12-05 Thread Andy Shevchenko
On Sun, Dec 04, 2022 at 03:55:19PM -0800, Dmitry Torokhov wrote:
> On Sun, Dec 04, 2022 at 01:10:19PM +0100, Arnd Bergmann wrote:
> > On Sun, Dec 4, 2022, at 05:50, Dmitry Torokhov wrote:
> > >
> > > SoC team, the problematic patch has been in next for a while and it
> > > would be great to get the fix in to make sure the driver is not broken
> > > in 6.2. Thanks!
> > 
> > I have no problem taking thsi patch, but I get a merge conflict that
> > I'm not sure how to resolve:
> > 
> > 
> > @@@ -186,23 -182,27 +180,43 @@@ struct qe_pin *qe_pin_request(struct de
> > if (WARN_ON(!gc)) {
> > err = -ENODEV;
> > goto err0;
> > ++<<< HEAD
> >  +  }
> >  +  qe_pin->gpiod = gpiod;
> >  +  qe_pin->controller = gpiochip_get_data(gc);
> >  +  /*
> >  +   * FIXME: this gets the local offset on the gpio_chip so that the 
> > driver
> >  +   * can manipulate pin control settings through its custom API. The 
> > real
> >  +   * solution is to create a real pin control driver for this.
> >  +   */
> >  +  qe_pin->num = gpio_chip_hwgpio(gpiod);
> >  +
> >  +  if (!of_device_is_compatible(gc->of_node, 
> > "fsl,mpc8323-qe-pario-bank")) {
> >  +  pr_debug("%s: tried to get a non-qe pin\n", __func__);
> >  +  gpiod_put(gpiod);
> > ++===
> > +   } else if (!fwnode_device_is_compatible(gc->fwnode,
> > +   
> > "fsl,mpc8323-qe-pario-bank")) {
> > +   dev_dbg(dev, "%s: tried to get a non-qe pin\n", __func__);
> > ++>>> soc: fsl: qe: request pins non-exclusively
> > err = -EINVAL;
> > -   goto err0;
> > +   } else {
> > +   qe_pin->controller = gpiochip_get_data(gc);
> > +   /*
> > +* FIXME: this gets the local offset on the gpio_chip so 
> > that
> > +* the driver can manipulate pin control settings through 
> > its
> > +* custom API. The real solution is to create a real pin 
> > control
> > +* driver for this.
> > +*/
> > +   qe_pin->num = desc_to_gpio(gpiod) - gc->base;
> > }
> > 
> > Could you rebase the patch on top of the soc/driver branch in the
> > soc tree and send the updated version?
> 
> I see, it conflicts with:
> 
>   c9eb6e546a23 soc: fsl: qe: Switch to use fwnode instead of of_node
> 
> that is in next but not in soc/driver tree/branch.

That's due to no reaction on the patch [1] from Freescale maintainers (*).
Either soc subsystem can pull this [2] or your patch can go via
pin control subsystem.

*) Note, there is not Arnd's name nor soc mailing list in the MAINTAINERS
   regarding those files, so I had had no idea about the correct route of
   the change.

[1]: 
https://lore.kernel.org/lkml/20221005152947.71696-1-andriy.shevche...@linux.intel.com/
[2]: https://lore.kernel.org/linux-gpio/y3yy%2fm0f%2frh0j...@black.fi.intel.com/

-- 
With Best Regards,
Andy Shevchenko




Re: [PATCH v8 2/3] freezer: refactor pm_freezing into a function.

2022-12-05 Thread Ricardo Ribalda
Hi Rafael

On Fri, 2 Dec 2022 at 18:48, Rafael J. Wysocki  wrote:
>
> On Thu, Dec 1, 2022 at 12:08 PM Ricardo Ribalda  wrote:
> >
> > Add a way to let the drivers know if the processes are frozen.
> >
> > This is needed by drivers that are waiting for processes to end on their
> > shutdown path.
> >
> > Convert pm_freezing into a function and export it, so it can be used by
> > drivers that are either built-in or modules.
> >
> > Cc: sta...@vger.kernel.org
> > Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine 
> > drivers in .shutdown")
> > Signed-off-by: Ricardo Ribalda 
>
> Why can't you export the original pm_freezing variable and why is this
> fixing anything?

Because then any module will be able to modify the content of the variable.

The Fixes: is because the last patch on the set is doing a real fix.
If you only cherry-pick the last patch on a stable branch, the build
will fail. (Also, the zero-day builder complains)

Anyway, I think we can hold this patch for a bit. The snd people are
discussing if this the way to handle it, or if we should handle
.shutdown in a different way.

Thanks!


>
> > ---
> >  include/linux/freezer.h |  3 ++-
> >  kernel/freezer.c|  3 +--
> >  kernel/power/process.c  | 24 
> >  3 files changed, 23 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/linux/freezer.h b/include/linux/freezer.h
> > index b303472255be..3413c869d68b 100644
> > --- a/include/linux/freezer.h
> > +++ b/include/linux/freezer.h
> > @@ -13,7 +13,7 @@
> >  #ifdef CONFIG_FREEZER
> >  DECLARE_STATIC_KEY_FALSE(freezer_active);
> >
> > -extern bool pm_freezing;   /* PM freezing in effect */
> > +bool pm_freezing(void);
> >  extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
> >
> >  /*
> > @@ -80,6 +80,7 @@ static inline int freeze_processes(void) { return 
> > -ENOSYS; }
> >  static inline int freeze_kernel_threads(void) { return -ENOSYS; }
> >  static inline void thaw_processes(void) {}
> >  static inline void thaw_kernel_threads(void) {}
> > +static inline bool pm_freezing(void) { return false; }
> >
> >  static inline bool try_to_freeze(void) { return false; }
> >
> > diff --git a/kernel/freezer.c b/kernel/freezer.c
> > index 4fad0e6fca64..2d3530ebdb7e 100644
> > --- a/kernel/freezer.c
> > +++ b/kernel/freezer.c
> > @@ -20,7 +20,6 @@ EXPORT_SYMBOL(freezer_active);
> >   * indicate whether PM freezing is in effect, protected by
> >   * system_transition_mutex
> >   */
> > -bool pm_freezing;
> >  bool pm_nosig_freezing;
> >
> >  /* protects freezing and frozen transitions */
> > @@ -46,7 +45,7 @@ bool freezing_slow_path(struct task_struct *p)
> > if (pm_nosig_freezing || cgroup_freezing(p))
> > return true;
> >
> > -   if (pm_freezing && !(p->flags & PF_KTHREAD))
> > +   if (pm_freezing() && !(p->flags & PF_KTHREAD))
> > return true;
> >
> > return false;
> > diff --git a/kernel/power/process.c b/kernel/power/process.c
> > index ddd9988327fe..8a4d0e2c8c20 100644
> > --- a/kernel/power/process.c
> > +++ b/kernel/power/process.c
> > @@ -108,6 +108,22 @@ static int try_to_freeze_tasks(bool user_only)
> > return todo ? -EBUSY : 0;
> >  }
> >
> > +/*
> > + * Indicate whether PM freezing is in effect, protected by
> > + * system_transition_mutex.
> > + */
> > +static bool pm_freezing_internal;
> > +
> > +/**
> > + * pm_freezing - indicate whether PM freezing is in effect.
> > + *
> > + */
> > +bool pm_freezing(void)
> > +{
> > +   return pm_freezing_internal;
> > +}
> > +EXPORT_SYMBOL(pm_freezing);
>
> Use EXPORT_SYMBOL_GPL() instead, please.
>
> > +
> >  /**
> >   * freeze_processes - Signal user space processes to enter the 
> > refrigerator.
> >   * The current thread will not be frozen.  The same process that calls
> > @@ -126,12 +142,12 @@ int freeze_processes(void)
> > /* Make sure this task doesn't get frozen */
> > current->flags |= PF_SUSPEND_TASK;
> >
> > -   if (!pm_freezing)
> > +   if (!pm_freezing())
> > static_branch_inc(_active);
> >
> > pm_wakeup_clear(0);
> > pr_info("Freezing user space processes ... ");
> > -   pm_freezing = true;
> > +   pm_freezing_internal = true;
> > error = try_to_freeze_tasks(true);
> > if (!error) {
> > __usermodehelper_set_disable_depth(UMH_DISABLED);
> > @@ -187,9 +203,9 @@ void thaw_processes(void)
> > struct task_struct *curr = current;
> >
> > trace_suspend_resume(TPS("thaw_processes"), 0, true);
> > -   if (pm_freezing)
> > +   if (pm_freezing())
> > static_branch_dec(_active);
> > -   pm_freezing = false;
> > +   pm_freezing_internal = false;
> > pm_nosig_freezing = false;
> >
> > oom_killer_enable();
> >
> > --
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Chromeos Kdump" group.
> To unsubscribe from 

[PATCH] serial: ucc_uart: Add of_node_put() in ucc_uart_remove()

2022-12-05 Thread Liang He
In ucc_uart_probe(), we have added proper of_node_put() in the failure
paths. However, we miss it before we free *qe_port* in the remove() function.

Signed-off-by: Liang He 
---
 drivers/tty/serial/ucc_uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 82cf14dd3d43..461d54de6351 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1469,6 +1469,8 @@ static int ucc_uart_remove(struct platform_device *ofdev)
 
uart_remove_one_port(_uart_driver, _port->port);
 
+   of_node_put(qe_port->np);
+
kfree(qe_port);
 
return 0;
-- 
2.25.1



[PATCH] selftests/powerpc: Fix resource leaks

2022-12-05 Thread Miaoqian Lin
In check_all_cpu_dscr_defaults, opendir() opens the directory stream.
Add missing closedir() in the error path to release it.

In check_cpu_dscr_default, open() creates an open file descriptor.
Add missing close() in the error path to release it.

Fixes: ebd5858c904b ("selftests/powerpc: Add test for all DSCR sysfs 
interfaces")
Signed-off-by: Miaoqian Lin 
---
 tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c 
b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c
index fbbdffdb2e5d..f20d1c166d1e 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c
+++ b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c
@@ -24,6 +24,7 @@ static int check_cpu_dscr_default(char *file, unsigned long 
val)
rc = read(fd, buf, sizeof(buf));
if (rc == -1) {
perror("read() failed");
+   close(fd);
return 1;
}
close(fd);
@@ -65,8 +66,10 @@ static int check_all_cpu_dscr_defaults(unsigned long val)
if (access(file, F_OK))
continue;
 
-   if (check_cpu_dscr_default(file, val))
+   if (check_cpu_dscr_default(file, val)) {
+   closedir(sysfs);
return 1;
+   }
}
closedir(sysfs);
return 0;
-- 
2.25.1