Re: [PATCH v2] ASoC: dt-bindings: fsl,ssi: Convert to YAML

2024-04-24 Thread Shengjiu Wang
On Tue, Apr 23, 2024 at 10:24 PM Rob Herring  wrote:
>
> On Mon, Apr 22, 2024 at 01:48:14PM +0800, Shengjiu Wang wrote:
> > Convert the fsl,ssi binding to YAML.
> >
> > Add below compatible strings which were not listed
> > in document:
> >
> > fsl,imx50-ssi
> > fsl,imx53-ssi
> > fsl,imx25-ssi
> > fsl,imx27-ssi
> > fsl,imx6q-ssi
> > fsl,imx6sl-ssi
> > fsl,imx6sx-ssi
> >
> > Add below fsl,mode strings which were not listed.
> >
> > i2s-slave
> > i2s-master
> > lj-slave
> > lj-master
> > rj-slave
> > rj-master
> >
> > Add 'ac97-gpios' property which were not listed.
> > Then dtbs_check can pass.
> >
> > And remove the 'codec' description which should be
> > in the 'codec' binding doc.
> >
> > Signed-off-by: Shengjiu Wang 
> > ---
> > changes in v2:
> > - change fallback string to const.
> > - add dai-common.yaml
> > - add ac97-gpios property
> >
> >  .../devicetree/bindings/sound/fsl,ssi.txt |  87 
> >  .../devicetree/bindings/sound/fsl,ssi.yaml| 192 ++
> >  2 files changed, 192 insertions(+), 87 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/sound/fsl,ssi.txt
> >  create mode 100644 Documentation/devicetree/bindings/sound/fsl,ssi.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt 
> > b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
> > deleted file mode 100644
> > index 7e15a85cecd2..
> > --- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt
> > +++ /dev/null
> > @@ -1,87 +0,0 @@
> > -Freescale Synchronous Serial Interface
> > -
> > -The SSI is a serial device that communicates with audio codecs.  It can
> > -be programmed in AC97, I2S, left-justified, or right-justified modes.
> > -
> > -Required properties:
> > -- compatible:   Compatible list, should contain one of the following
> > -compatibles:
> > -  fsl,mpc8610-ssi
> > -  fsl,imx51-ssi
> > -  fsl,imx35-ssi
> > -  fsl,imx21-ssi
> > -- cell-index:   The SSI, <0> = SSI1, <1> = SSI2, and so on.
> > -- reg:  Offset and length of the register set for the device.
> > -- interrupts:where a is the interrupt number and b is a
> > -field that represents an encoding of the sense and
> > -level information for the interrupt.  This should be
> > -encoded based on the information in section 2)
> > -depending on the type of interrupt controller you
> > -have.
> > -- fsl,fifo-depth:   The number of elements in the transmit and receive 
> > FIFOs.
> > -This number is the maximum allowed value for 
> > SFCSR[TFWM0].
> > - - clocks:  "ipg" - Required clock for the SSI unit
> > -"baud" - Required clock for SSI master mode. Otherwise 
> > this
> > -   clock is not used
> > -
> > -Required are also ac97 link bindings if ac97 is used. See
> > -Documentation/devicetree/bindings/sound/soc-ac97link.txt for the necessary
> > -bindings.
> > -
> > -Optional properties:
> > -- codec-handle: Phandle to a 'codec' node that defines an audio
> > -codec connected to this SSI.  This node is typically
> > -a child of an I2C or other control node.
> > -- fsl,fiq-stream-filter: Bool property. Disabled DMA and use FIQ instead to
> > - filter the codec stream. This is necessary for some boards
> > - where an incompatible codec is connected to this SSI, e.g.
> > - on pca100 and pcm043.
> > -- dmas:  Generic dma devicetree binding as described in
> > - Documentation/devicetree/bindings/dma/dma.txt.
> > -- dma-names: Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
> > - is not defined.
> > -- fsl,mode: The operating mode for the AC97 interface only.
> > -"ac97-slave" - AC97 mode, SSI is clock slave
> > -"ac97-master" - AC97 mode, SSI is clock master
> > -- fsl,ssi-asynchronous:
> > -If specified, the SSI is to be programmed in 
> > asynchronous
> > -mode.  In this mode, pins SRCK, STCK, SRFS, and STFS 
> > must
> > -all be connected to valid signals.  In synchronous 
> > mode,
> > -SRCK and SRFS are ignored.  Asynchronous mode allows
> > -playback and capture to use different sample sizes and
> > -sample rates.  Some drivers may require that SRCK and 
> > STCK
> > -be connected together, and SRFS and STFS be connected
> > -together.  This would still allow different sample 
> > sizes,
> > -but not different sample rates.
> > -- fsl,playback-dma: Phandle to a node for the DMA channel to use for
> > -playback 

Re: [PATCH v3 00/11] sysctl: treewide: constify ctl_table argument of sysctl handlers

2024-04-24 Thread Jakub Kicinski
On Tue, 23 Apr 2024 09:54:35 +0200 Thomas Weißschuh wrote:
> The series was split from my larger series sysctl-const series [0].
> It only focusses on the proc_handlers but is an important step to be
> able to move all static definitions of ctl_table into .rodata.

Split this per subsystem, please.


Re: [PATCH 1/2] MAINTAINERS: Make cxlflash obsolete

2024-04-24 Thread Martin K. Petersen
On Tue, 09 Apr 2024 13:10:26 +1000, Andrew Donnellan wrote:

> The cxlflash driver is no longer actively maintained and we intend to
> remove it in a future kernel release. Change its status to obsolete.
> 
> While we're here, Matthew Ochs no longer works at IBM and is no longer in
> a position to access cxlflash hardware, so remove him from the maintainers
> list.
> 
> [...]

Applied to 6.10/scsi-queue, thanks!

[1/2] MAINTAINERS: Make cxlflash obsolete
  https://git.kernel.org/mkp/scsi/c/6d97e807c906

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH v2] powerpc/pseries: remove returning ENODEV when uevent is triggered

2024-04-24 Thread Lidong Zhong
Hi Michael,

Could you share your opinion about this new patch please?

On Thu, Apr 11, 2024 at 10:04 AM Lidong Zhong  wrote:

> We noticed the following nuisance messages during boot process
>
> [7.120610][ T1060] vio vio: uevent: failed to send synthetic uevent
> [7.122281][ T1060] vio 4000: uevent: failed to send synthetic uevent
> [7.122304][ T1060] vio 4001: uevent: failed to send synthetic uevent
> [7.122324][ T1060] vio 4002: uevent: failedto send synthetic uevent
> [7.122345][ T1060] vio 4004: uevent: failed to send synthetic uevent
>
> It's caused by either vio_register_device_node() fails to set dev->of_node
> or the missing "compatible" property. To keep align with the definition of
> modalias in modalias_show(), we remove the return of ENODEV in such cases.
> The failure messages can also be suppressed with this change.
>
> v2: keep align the definition of modalias with modalias_show()
> Signed-off-by: Lidong Zhong 
> ---
>  arch/powerpc/platforms/pseries/vio.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/vio.c
> b/arch/powerpc/platforms/pseries/vio.c
> index 90ff85c879bf..b2babfdbc40b 100644
> --- a/arch/powerpc/platforms/pseries/vio.c
> +++ b/arch/powerpc/platforms/pseries/vio.c
> @@ -1592,13 +1592,9 @@ static int vio_hotplug(const struct device *dev,
> struct kobj_uevent_env *env)
> const char *cp;
>
> dn = dev->of_node;
> -   if (!dn)
> -   return -ENODEV;
> -   cp = of_get_property(dn, "compatible", NULL);
> -   if (!cp)
> -   return -ENODEV;
> +   if (dn && (cp = of_get_property(dn, "compatible", NULL)))
> +   add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type,
> cp);
>
> -   add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type, cp);
> return 0;
>  }
>
> --
> 2.35.3
>
>

-- 
Regards,
Lidong Zhong


Re: [PATCH] ibmvnic: Use -EBUSY in __ibmvnic_reset()

2024-04-24 Thread Jakub Kicinski
On Tue, 23 Apr 2024 18:41:48 +0300 Dan Carpenter wrote:
> > So, the point of the patch not doing any behavioral differences is still
> > true.  
> 
> Ah yes.  You're right.

Hard call but overall I think this wasted more reviewer time than it's
worth. So in the spirit of not encouraging noise I'm not applying this.
-- 
pw-bot: reject


Re: [PATCH 8/9] drivers/media/*: Convert from tasklet to BH workqueue

2024-04-24 Thread Allen Pais



> On Apr 24, 2024, at 2:12 AM, Hans Verkuil  wrote:
> 
> On 27/03/2024 17:03, Allen Pais wrote:
>> The only generic interface to execute asynchronously in the BH context is
>> tasklet; however, it's marked deprecated and has some design flaws. To
>> replace tasklets, BH workqueue support was recently added. A BH workqueue
>> behaves similarly to regular workqueues except that the queued work items
>> are executed in the BH context.
>> 
>> This patch converts drivers/media/* from tasklet to BH workqueue.
>> 
>> Based on the work done by Tejun Heo 
>> Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10
>> 
>> Signed-off-by: Allen Pais 
>> ---
>> drivers/media/pci/bt8xx/bt878.c   |  8 ++--
>> drivers/media/pci/bt8xx/bt878.h   |  3 +-
>> drivers/media/pci/bt8xx/dvb-bt8xx.c   |  9 ++--
>> drivers/media/pci/ddbridge/ddbridge.h |  3 +-
>> drivers/media/pci/mantis/hopper_cards.c   |  2 +-
>> drivers/media/pci/mantis/mantis_cards.c   |  2 +-
>> drivers/media/pci/mantis/mantis_common.h  |  3 +-
>> drivers/media/pci/mantis/mantis_dma.c |  5 ++-
>> drivers/media/pci/mantis/mantis_dma.h |  2 +-
>> drivers/media/pci/mantis/mantis_dvb.c | 12 +++---
>> drivers/media/pci/ngene/ngene-core.c  | 23 ++-
>> drivers/media/pci/ngene/ngene.h   |  5 ++-
>> drivers/media/pci/smipcie/smipcie-main.c  | 18 
>> drivers/media/pci/smipcie/smipcie.h   |  3 +-
>> drivers/media/pci/ttpci/budget-av.c   |  3 +-
>> drivers/media/pci/ttpci/budget-ci.c   | 27 ++--
>> drivers/media/pci/ttpci/budget-core.c | 10 ++---
>> drivers/media/pci/ttpci/budget.h  |  5 ++-
>> drivers/media/pci/tw5864/tw5864-core.c|  2 +-
>> drivers/media/pci/tw5864/tw5864-video.c   | 13 +++---
>> drivers/media/pci/tw5864/tw5864.h |  7 ++--
>> drivers/media/platform/intel/pxa_camera.c | 15 +++
>> drivers/media/platform/marvell/mcam-core.c| 11 ++---
>> drivers/media/platform/marvell/mcam-core.h|  3 +-
>> .../st/sti/c8sectpfe/c8sectpfe-core.c | 15 +++
>> .../st/sti/c8sectpfe/c8sectpfe-core.h |  2 +-
>> drivers/media/radio/wl128x/fmdrv.h|  7 ++--
>> drivers/media/radio/wl128x/fmdrv_common.c | 41 ++-
>> drivers/media/rc/mceusb.c |  2 +-
>> drivers/media/usb/ttusb-dec/ttusb_dec.c   | 21 +-
>> 30 files changed, 151 insertions(+), 131 deletions(-)
>> 
>> diff --git a/drivers/media/pci/bt8xx/bt878.c 
>> b/drivers/media/pci/bt8xx/bt878.c
>> index 90972d6952f1..983ec29108f0 100644
>> --- a/drivers/media/pci/bt8xx/bt878.c
>> +++ b/drivers/media/pci/bt8xx/bt878.c
>> @@ -300,8 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
>>  }
>>  if (astat & BT878_ARISCI) {
>>  bt->finished_block = (stat & BT878_ARISCS) >> 28;
>> -if (bt->tasklet.callback)
>> -tasklet_schedule(>tasklet);
>> +if (bt->work.func)
>> +queue_work(system_bh_wq,
> 
> I stopped reviewing here: this clearly has not been compile tested.
> 
> Also please check the patch with 'checkpatch.pl --strict' and fix the 
> reported issues.
> 
> Regards,
> 
>   Hans

 Hans,

   Thanks for taking the time out to review. This was a mistake, I sent out a 
v2 which had
This fixed. I am working on v3 based on some of the comments I received  
recently. Will
Appreciate your review when it is sent out.

Allen

> 
>>  break;
>>  }
>>  count++;
>> @@ -478,8 +478,8 @@ static int bt878_probe(struct pci_dev *dev, const struct 
>> pci_device_id *pci_id)
>>  btwrite(0, BT878_AINT_MASK);
>>  bt878_num++;
>> 
>> -if (!bt->tasklet.func)
>> -tasklet_disable(>tasklet);
>> +if (!bt->work.func)
>> +disable_work_sync(>work);
>> 
>>  return 0;
>> 
>> diff --git a/drivers/media/pci/bt8xx/bt878.h 
>> b/drivers/media/pci/bt8xx/bt878.h
>> index fde8db293c54..b9ce78e5116b 100644
>> --- a/drivers/media/pci/bt8xx/bt878.h
>> +++ b/drivers/media/pci/bt8xx/bt878.h
>> @@ -14,6 +14,7 @@
>> #include 
>> #include 
>> #include 
>> +#include 
>> 
>> #include "bt848.h"
>> #include "bttv.h"
>> @@ -120,7 +121,7 @@ struct bt878 {
>>  dma_addr_t risc_dma;
>>  u32 risc_pos;
>> 
>> -struct tasklet_struct tasklet;
>> +struct work_struct work;
>>  int shutdown;
>> };
>> 
>> diff --git a/drivers/media/pci/bt8xx/dvb-bt8xx.c 
>> b/drivers/media/pci/bt8xx/dvb-bt8xx.c
>> index 390cbba6c065..8c0e1fa764a4 100644
>> --- a/drivers/media/pci/bt8xx/dvb-bt8xx.c
>> +++ b/drivers/media/pci/bt8xx/dvb-bt8xx.c
>> @@ -15,6 +15,7 @@
>> #include 
>> #include 
>> #include 
>> +#include 
>> 
>> #include 
>> #include 
>> @@ -39,9 +40,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>> 
>> #define IF_FREQUENCYx6 217/* 6 * 

[PATCH linux-next] macintosh/macio-adb: replace of_node_put() with __free

2024-04-24 Thread sundar
use the new cleanup magic to replace of_node_put() with
__free(device_node) marking to auto release when they get out of scope.

Suggested-by: Julia Lawall 
Signed-off-by: sundar 
---
 drivers/macintosh/macio-adb.c | 24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 779f1268286e..85d404031cf5 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -83,35 +83,32 @@ struct adb_driver macio_adb_driver = {
 
 int macio_probe(void)
 {
-   struct device_node *np;
+   struct device_node *np __free(device_node) =
+   of_find_compatible_node(NULL, "adb", "chrp,adb0");
 
-   np = of_find_compatible_node(NULL, "adb", "chrp,adb0");
-   if (np) {
-   of_node_put(np);
+   if (np)
return 0;
-   }
+
return -ENODEV;
 }
 
 int macio_init(void)
 {
-   struct device_node *adbs;
+   struct device_node *adbs __free(device_node) =
+   of_find_compatible_node(NULL, "adb", "chrp,adb0");
struct resource r;
unsigned int irq;
 
-   adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
if (!adbs)
return -ENXIO;
 
-   if (of_address_to_resource(adbs, 0, )) {
-   of_node_put(adbs);
+   if (of_address_to_resource(adbs, 0, ))
return -ENXIO;
-   }
+
adb = ioremap(r.start, sizeof(struct adb_regs));
-   if (!adb) {
-   of_node_put(adbs);
+   if (!adb)
return -ENOMEM;
-   }
+
 
out_8(>ctrl.r, 0);
out_8(>intr.r, 0);
@@ -121,7 +118,6 @@ int macio_init(void)
out_8(>autopoll.r, APE);
 
irq = irq_of_parse_and_map(adbs, 0);
-   of_node_put(adbs);
if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) {
iounmap(adb);
printk(KERN_ERR "ADB: can't get irq %d\n", irq);
-- 
2.34.1



Re: [PATCH V2 04/19] math64: Tidy mul_u64_u32_shr()

2024-04-24 Thread Peter Zijlstra
On Mon, Mar 25, 2024 at 08:40:08AM +0200, Adrian Hunter wrote:
> Put together declaration and initialization of local variables.
> 
> Suggested-by: Thomas Gleixner 
> Signed-off-by: Adrian Hunter 
> ---

Nothing wrong with this patch, but it is highly unlikely this code is
actually tested much. Most (sane) architectures will use the __int128
version.

>  include/linux/math64.h | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/include/linux/math64.h b/include/linux/math64.h
> index bf74478926d4..fd13622b2056 100644
> --- a/include/linux/math64.h
> +++ b/include/linux/math64.h
> @@ -179,16 +179,12 @@ static __always_inline u64 mul_u64_u64_shr(u64 a, u64 
> mul, unsigned int shift)
>  #ifndef mul_u64_u32_shr
>  static __always_inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int 
> shift)
>  {
> - u32 ah, al;
> + u32 ah = a >> 32, al = a;
>   u64 ret;
>  
> - al = a;
> - ah = a >> 32;
> -
>   ret = mul_u32_u32(al, mul) >> shift;
>   if (ah)
>   ret += mul_u32_u32(ah, mul) << (32 - shift);
> -
>   return ret;
>  }
>  #endif /* mul_u64_u32_shr */
> -- 
> 2.34.1
> 


Re: [PATCH 8/9] drivers/media/*: Convert from tasklet to BH workqueue

2024-04-24 Thread Hans Verkuil
On 27/03/2024 17:03, Allen Pais wrote:
> The only generic interface to execute asynchronously in the BH context is
> tasklet; however, it's marked deprecated and has some design flaws. To
> replace tasklets, BH workqueue support was recently added. A BH workqueue
> behaves similarly to regular workqueues except that the queued work items
> are executed in the BH context.
> 
> This patch converts drivers/media/* from tasklet to BH workqueue.
> 
> Based on the work done by Tejun Heo 
> Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10
> 
> Signed-off-by: Allen Pais 
> ---
>  drivers/media/pci/bt8xx/bt878.c   |  8 ++--
>  drivers/media/pci/bt8xx/bt878.h   |  3 +-
>  drivers/media/pci/bt8xx/dvb-bt8xx.c   |  9 ++--
>  drivers/media/pci/ddbridge/ddbridge.h |  3 +-
>  drivers/media/pci/mantis/hopper_cards.c   |  2 +-
>  drivers/media/pci/mantis/mantis_cards.c   |  2 +-
>  drivers/media/pci/mantis/mantis_common.h  |  3 +-
>  drivers/media/pci/mantis/mantis_dma.c |  5 ++-
>  drivers/media/pci/mantis/mantis_dma.h |  2 +-
>  drivers/media/pci/mantis/mantis_dvb.c | 12 +++---
>  drivers/media/pci/ngene/ngene-core.c  | 23 ++-
>  drivers/media/pci/ngene/ngene.h   |  5 ++-
>  drivers/media/pci/smipcie/smipcie-main.c  | 18 
>  drivers/media/pci/smipcie/smipcie.h   |  3 +-
>  drivers/media/pci/ttpci/budget-av.c   |  3 +-
>  drivers/media/pci/ttpci/budget-ci.c   | 27 ++--
>  drivers/media/pci/ttpci/budget-core.c | 10 ++---
>  drivers/media/pci/ttpci/budget.h  |  5 ++-
>  drivers/media/pci/tw5864/tw5864-core.c|  2 +-
>  drivers/media/pci/tw5864/tw5864-video.c   | 13 +++---
>  drivers/media/pci/tw5864/tw5864.h |  7 ++--
>  drivers/media/platform/intel/pxa_camera.c | 15 +++
>  drivers/media/platform/marvell/mcam-core.c| 11 ++---
>  drivers/media/platform/marvell/mcam-core.h|  3 +-
>  .../st/sti/c8sectpfe/c8sectpfe-core.c | 15 +++
>  .../st/sti/c8sectpfe/c8sectpfe-core.h |  2 +-
>  drivers/media/radio/wl128x/fmdrv.h|  7 ++--
>  drivers/media/radio/wl128x/fmdrv_common.c | 41 ++-
>  drivers/media/rc/mceusb.c |  2 +-
>  drivers/media/usb/ttusb-dec/ttusb_dec.c   | 21 +-
>  30 files changed, 151 insertions(+), 131 deletions(-)
> 
> diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
> index 90972d6952f1..983ec29108f0 100644
> --- a/drivers/media/pci/bt8xx/bt878.c
> +++ b/drivers/media/pci/bt8xx/bt878.c
> @@ -300,8 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
>   }
>   if (astat & BT878_ARISCI) {
>   bt->finished_block = (stat & BT878_ARISCS) >> 28;
> - if (bt->tasklet.callback)
> - tasklet_schedule(>tasklet);
> + if (bt->work.func)
> + queue_work(system_bh_wq,

I stopped reviewing here: this clearly has not been compile tested.

Also please check the patch with 'checkpatch.pl --strict' and fix the reported 
issues.

Regards,

Hans

>   break;
>   }
>   count++;
> @@ -478,8 +478,8 @@ static int bt878_probe(struct pci_dev *dev, const struct 
> pci_device_id *pci_id)
>   btwrite(0, BT878_AINT_MASK);
>   bt878_num++;
>  
> - if (!bt->tasklet.func)
> - tasklet_disable(>tasklet);
> + if (!bt->work.func)
> + disable_work_sync(>work);
>  
>   return 0;
>  
> diff --git a/drivers/media/pci/bt8xx/bt878.h b/drivers/media/pci/bt8xx/bt878.h
> index fde8db293c54..b9ce78e5116b 100644
> --- a/drivers/media/pci/bt8xx/bt878.h
> +++ b/drivers/media/pci/bt8xx/bt878.h
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "bt848.h"
>  #include "bttv.h"
> @@ -120,7 +121,7 @@ struct bt878 {
>   dma_addr_t risc_dma;
>   u32 risc_pos;
>  
> - struct tasklet_struct tasklet;
> + struct work_struct work;
>   int shutdown;
>  };
>  
> diff --git a/drivers/media/pci/bt8xx/dvb-bt8xx.c 
> b/drivers/media/pci/bt8xx/dvb-bt8xx.c
> index 390cbba6c065..8c0e1fa764a4 100644
> --- a/drivers/media/pci/bt8xx/dvb-bt8xx.c
> +++ b/drivers/media/pci/bt8xx/dvb-bt8xx.c
> @@ -15,6 +15,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -39,9 +40,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>  
>  #define IF_FREQUENCYx6 217/* 6 * 36.167MHz */
>  
> -static void dvb_bt8xx_task(struct tasklet_struct *t)
> +static void dvb_bt8xx_task(struct work_struct *t)
>  {
> - struct bt878 *bt = from_tasklet(bt, t, tasklet);
> + struct bt878 *bt = from_work(bt, t, work);
>   struct dvb_bt8xx_card *card = dev_get_drvdata(>adapter->dev);
>  
>   dprintk("%d\n", card->bt->finished_block);
> 

[PATCH 1/2] radix/kfence: map __kfence_pool at page granularity

2024-04-24 Thread Hari Bathini
When KFENCE is enabled, total system memory is mapped at page level
granularity. But in radix MMU mode, ~3GB additional memory is needed
to map 100GB of system memory at page level granularity when compared
to using 2MB direct mapping. This is not desired considering KFENCE is
designed to be enabled in production kernels [1]. Also, mapping memory
allocated for KFENCE pool at page granularity seems sufficient enough
to enable KFENCE support. So, allocate __kfence_pool during bootup and
map it at page granularity instead of mapping all system memory at
page granularity.

Without patch:
# cat /proc/meminfo
MemTotal:   101201920 kB

With patch:
# cat /proc/meminfo
MemTotal:   104483904 kB

All kfence_test.c testcases passed with this patch.

[1] https://lore.kernel.org/all/20201103175841.3495947-2-el...@google.com/

Signed-off-by: Hari Bathini 
---
 arch/powerpc/include/asm/kfence.h|  5 
 arch/powerpc/mm/book3s64/radix_pgtable.c | 34 ++--
 arch/powerpc/mm/init_64.c| 14 ++
 3 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/kfence.h 
b/arch/powerpc/include/asm/kfence.h
index 424ceef82ae6..18ec2b06ba1e 100644
--- a/arch/powerpc/include/asm/kfence.h
+++ b/arch/powerpc/include/asm/kfence.h
@@ -8,6 +8,7 @@
 #ifndef __ASM_POWERPC_KFENCE_H
 #define __ASM_POWERPC_KFENCE_H
 
+#include 
 #include 
 #include 
 
@@ -15,6 +16,10 @@
 #define ARCH_FUNC_PREFIX "."
 #endif
 
+#ifdef CONFIG_KFENCE
+extern bool kfence_early_init;
+#endif
+
 static inline bool arch_kfence_init_pool(void)
 {
return true;
diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c 
b/arch/powerpc/mm/book3s64/radix_pgtable.c
index 15e88f1439ec..fccbf92f279b 100644
--- a/arch/powerpc/mm/book3s64/radix_pgtable.c
+++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -291,9 +292,8 @@ static unsigned long next_boundary(unsigned long addr, 
unsigned long end)
return end;
 }
 
-static int __meminit create_physical_mapping(unsigned long start,
-unsigned long end,
-int nid, pgprot_t _prot)
+static int __meminit create_physical_mapping(unsigned long start, unsigned 
long end, int nid,
+pgprot_t _prot, unsigned long 
mapping_sz_limit)
 {
unsigned long vaddr, addr, mapping_size = 0;
bool prev_exec, exec = false;
@@ -301,7 +301,10 @@ static int __meminit create_physical_mapping(unsigned long 
start,
int psize;
unsigned long max_mapping_size = memory_block_size;
 
-   if (debug_pagealloc_enabled_or_kfence())
+   if (mapping_sz_limit < max_mapping_size)
+   max_mapping_size = mapping_sz_limit;
+
+   if (debug_pagealloc_enabled())
max_mapping_size = PAGE_SIZE;
 
start = ALIGN(start, PAGE_SIZE);
@@ -358,6 +361,7 @@ static int __meminit create_physical_mapping(unsigned long 
start,
 
 static void __init radix_init_pgtable(void)
 {
+   phys_addr_t kfence_pool __maybe_unused;
unsigned long rts_field;
phys_addr_t start, end;
u64 i;
@@ -365,6 +369,13 @@ static void __init radix_init_pgtable(void)
/* We don't support slb for radix */
slb_set_size(0);
 
+#ifdef CONFIG_KFENCE
+   if (kfence_early_init) {
+   kfence_pool = memblock_phys_alloc(KFENCE_POOL_SIZE, PAGE_SIZE);
+   memblock_mark_nomap(kfence_pool, KFENCE_POOL_SIZE);
+   }
+#endif
+
/*
 * Create the linear mapping
 */
@@ -380,10 +391,18 @@ static void __init radix_init_pgtable(void)
continue;
}
 
-   WARN_ON(create_physical_mapping(start, end,
-   -1, PAGE_KERNEL));
+   WARN_ON(create_physical_mapping(start, end, -1, PAGE_KERNEL, 
~0UL));
}
 
+#ifdef CONFIG_KFENCE
+   if (kfence_early_init) {
+   create_physical_mapping(kfence_pool, kfence_pool + 
KFENCE_POOL_SIZE, -1,
+   PAGE_KERNEL, PAGE_SIZE);
+   memblock_clear_nomap(kfence_pool, KFENCE_POOL_SIZE);
+   __kfence_pool = __va(kfence_pool);
+   }
+#endif
+
if (!cpu_has_feature(CPU_FTR_HVMODE) &&
cpu_has_feature(CPU_FTR_P9_RADIX_PREFETCH_BUG)) {
/*
@@ -874,8 +893,7 @@ int __meminit radix__create_section_mapping(unsigned long 
start,
return -1;
}
 
-   return create_physical_mapping(__pa(start), __pa(end),
-  nid, prot);
+   return create_physical_mapping(__pa(start), __pa(end), nid, prot, ~0UL);
 }
 
 int __meminit radix__remove_section_mapping(unsigned long start, unsigned long 
end)
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c

[PATCH 2/2] radix/kfence: support late __kfence_pool allocation

2024-04-24 Thread Hari Bathini
With commit b33f778bba5ef ("kfence: alloc kfence_pool after system
startup"), KFENCE pool can be allocated after system startup via the
page allocator. This can lead to problems as all memory is not mapped
at page granularity anymore with CONFIG_KFENCE. Address this by direct
mapping all memory at PMD level and split the mapping for PMD pages
that overlap with __kfence_pool to page level granularity if and when
__kfence_pool is allocated after system startup.

Signed-off-by: Hari Bathini 
---
 arch/powerpc/include/asm/book3s/64/radix.h |  2 +
 arch/powerpc/include/asm/kfence.h  | 14 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c   | 50 +-
 3 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/radix.h 
b/arch/powerpc/include/asm/book3s/64/radix.h
index 8f55ff74bb68..0423ddbcf73c 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -340,6 +340,8 @@ extern void radix__vmemmap_remove_mapping(unsigned long 
start,
 extern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
 pgprot_t flags, unsigned int psz);
 
+extern bool radix_kfence_init_pool(void);
+
 static inline unsigned long radix__get_tree_size(void)
 {
unsigned long rts_field;
diff --git a/arch/powerpc/include/asm/kfence.h 
b/arch/powerpc/include/asm/kfence.h
index 18ec2b06ba1e..c5d2fb2f9ecb 100644
--- a/arch/powerpc/include/asm/kfence.h
+++ b/arch/powerpc/include/asm/kfence.h
@@ -18,12 +18,24 @@
 
 #ifdef CONFIG_KFENCE
 extern bool kfence_early_init;
-#endif
+
+static inline bool kfence_alloc_pool_late(void)
+{
+   return !kfence_early_init;
+}
 
 static inline bool arch_kfence_init_pool(void)
 {
+#ifdef CONFIG_PPC_BOOK3S_64
+   if (radix_enabled())
+   return radix_kfence_init_pool();
+#endif
+
return true;
 }
+#else
+static inline bool kfence_alloc_pool_late(void) { return false; }
+#endif
 
 #ifdef CONFIG_PPC64
 static inline bool kfence_protect_page(unsigned long addr, bool protect)
diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c 
b/arch/powerpc/mm/book3s64/radix_pgtable.c
index fccbf92f279b..f4374e3e31e1 100644
--- a/arch/powerpc/mm/book3s64/radix_pgtable.c
+++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
@@ -253,6 +253,53 @@ void radix__mark_initmem_nx(void)
 }
 #endif /* CONFIG_STRICT_KERNEL_RWX */
 
+#ifdef CONFIG_KFENCE
+static inline int radix_split_pmd_page(pmd_t *pmd, unsigned long addr)
+{
+   pte_t *pte = pte_alloc_one_kernel(_mm);
+   unsigned long pfn = PFN_DOWN(__pa(addr));
+   int i;
+
+   if (!pte)
+   return -ENOMEM;
+
+   for (i = 0; i < PTRS_PER_PTE; i++) {
+   __set_pte_at(_mm, addr, pte + i, pfn_pte(pfn + i, 
PAGE_KERNEL), 0);
+   asm volatile("ptesync": : :"memory");
+   }
+   pmd_populate_kernel(_mm, pmd, pte);
+
+   flush_tlb_kernel_range(addr, addr + PMD_SIZE);
+   return 0;
+}
+
+bool radix_kfence_init_pool(void)
+{
+   unsigned int page_psize, pmd_psize;
+   unsigned long addr;
+   pmd_t *pmd;
+
+   if (!kfence_alloc_pool_late())
+   return true;
+
+   page_psize = shift_to_mmu_psize(PAGE_SHIFT);
+   pmd_psize = shift_to_mmu_psize(PMD_SHIFT);
+   for (addr = (unsigned long)__kfence_pool; is_kfence_address((void 
*)addr);
+addr += PAGE_SIZE) {
+   pmd = pmd_off_k(addr);
+
+   if (pmd_leaf(*pmd)) {
+   if (radix_split_pmd_page(pmd, addr & PMD_MASK))
+   return false;
+   update_page_count(pmd_psize, -1);
+   update_page_count(page_psize, PTRS_PER_PTE);
+   }
+   }
+
+   return true;
+}
+#endif
+
 static inline void __meminit
 print_mapping(unsigned long start, unsigned long end, unsigned long size, bool 
exec)
 {
@@ -391,7 +438,8 @@ static void __init radix_init_pgtable(void)
continue;
}
 
-   WARN_ON(create_physical_mapping(start, end, -1, PAGE_KERNEL, 
~0UL));
+   WARN_ON(create_physical_mapping(start, end, -1, PAGE_KERNEL,
+   kfence_alloc_pool_late() ? 
PMD_SIZE : ~0UL));
}
 
 #ifdef CONFIG_KFENCE
-- 
2.44.0



Re: linux-next: boot failure after merge of the modules tree

2024-04-24 Thread Mike Rapoport
On Wed, Apr 24, 2024 at 06:35:03PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the modules tree, today's linux-next boot (powerpc
> pseries_le_defconfig) failed like this:
> 
> BUG: Kernel NULL pointer dereference at 0x0030
> Faulting instruction address: 0xc057a4ec
> Oops: Kernel access of bad area, sig: 11 [#1]
> LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc5-08179-ga5ea707d10dc #1
> Hardware name: IBM pSeries (emulated by qemu) POWER8 (raw) 0x4d0200 0xf04 
> of:SLOF,HEAD pSeries
> NIP:  c057a4ec LR: c02cd32c CTR: c02cd304
> REGS: c4997700 TRAP: 0380   Not tainted  
> (6.9.0-rc5-08179-ga5ea707d10dc)
> MSR:  82009033   CR: 84002484  XER: 2000
> CFAR: c02cd328 IRQMASK: 0 
> GPR00: c02cd32c c49979a0 c163a500 0001 
> GPR04: 0001 4000  2cc0 
> GPR08: 0030 0100  2000 
> GPR12: c02cd304 c2b7 c00c  
> GPR16:     
> GPR20:     
> GPR24:   c2aa0940 c26c0a40 
> GPR28: 0001 c02cd32c 0030 c27d0f78 
> NIP [c057a4ec] execmem_alloc+0x5c/0x12c
> LR [c02cd32c] alloc_insn_page+0x28/0x70
> Call Trace:
> [c4997a40] [c02cd32c] alloc_insn_page+0x28/0x70
> [c4997a60] [c02d07a4] __get_insn_slot+0x1cc/0x29c
> [c4997aa0] [c005c434] arch_prepare_kprobe+0xbc/0x31c
> [c4997b20] [c02d1b40] register_kprobe+0x54c/0x878
> [c4997b90] [c2018828] arch_init_kprobes+0x28/0x40
> [c4997bb0] [c204b33c] init_kprobes+0x138/0x218
> [c4997c30] [c0010da8] do_one_initcall+0x80/0x2f8
> [c4997d00] [c2005aa8] kernel_init_freeable+0x1f8/0x520
> [c4997de0] [c0011148] kernel_init+0x34/0x26c
> [c4997e50] [c000debc] ret_from_kernel_user_thread+0x14/0x1c
> --- interrupt: 0 at 0x0
> Code: fbe1fff8 3940 38e02cc0 7c9c2378 7fa802a6 e8c91e48 f8010010 fb41ffd0 
> 39200100 fb61ffd8 f821ff61 7fc64214 <7ca6402a> eb5e0020 837e0028 e8de0008 
> ---[ end trace  ]---
> 
> note: swapper/0[1] exited with irqs disabled
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x000b
> 
> Bisected to commit
> 
>   18da532eefc8 ("mm/execmem, arch: convert remaining overrides of 
> module_alloc to execmem")
> 
> I have used the modules tree from next-20240423 for today.
> 
> This is a qemu boot test using:
> 
> qemu-system-ppc64 -M pseries -cpu POWER8 -m 2G -vga none -nographic -kernel 
> ~/next/powerpc_pseries_le_defconfig/vmlinux -initrd ./ppc64le-rootfs.cpio.gz

This should fix it for now, I'll rework initialization a bit in v6
 
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1c4be3373686..bea33bf538e9 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -176,6 +176,7 @@ config PPC
select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
select ARCH_WANT_LD_ORPHAN_WARN
select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP   if PPC_RADIX_MMU
+   select ARCH_WANTS_EXECMEM_EARLY if EXECMEM
select ARCH_WANTS_MODULES_DATA_IN_VMALLOC   if PPC_BOOK3S_32 || 
PPC_8xx
select ARCH_WEAK_RELEASE_ACQUIRE
select BINFMT_ELF


> -- 
> Cheers,
> Stephen Rothwell

-- 
Sincerely yours,
Mike.


[powerpc:topic/kdump-hotplug] BUILD SUCCESS 849599b702ef8977fcd5b2f27c61ef773c42bb88

2024-04-24 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
topic/kdump-hotplug
branch HEAD: 849599b702ef8977fcd5b2f27c61ef773c42bb88  powerpc/crash: add crash 
memory hotplug support

elapsed time: 1144m

configs tested: 175
configs skipped: 3

The following configs have been built successfully.
More configs may be tested in the coming days.

tested configs:
alphaalldefconfig   gcc  
alpha allnoconfig   gcc  
alphaallyesconfig   gcc  
alpha   defconfig   gcc  
arc  allmodconfig   gcc  
arc   allnoconfig   gcc  
arc  allyesconfig   gcc  
arc defconfig   gcc  
arc   randconfig-001-20240424   gcc  
arc   randconfig-002-20240424   gcc  
arm  allmodconfig   gcc  
arm   allnoconfig   clang
arm  allyesconfig   gcc  
arm defconfig   clang
arm  gemini_defconfig   clang
arm   imx_v6_v7_defconfig   clang
arm   milbeaut_m10v_defconfig   clang
arm   randconfig-001-20240424   gcc  
arm   randconfig-002-20240424   gcc  
arm   randconfig-003-20240424   gcc  
arm   tegra_defconfig   gcc  
arm64allmodconfig   clang
arm64 allnoconfig   gcc  
arm64allyesconfig   clang
arm64   defconfig   gcc  
arm64 randconfig-002-20240424   gcc  
arm64 randconfig-003-20240424   gcc  
csky allmodconfig   gcc  
csky  allnoconfig   gcc  
csky allyesconfig   gcc  
cskydefconfig   gcc  
csky  randconfig-001-20240424   gcc  
csky  randconfig-002-20240424   gcc  
hexagon  allmodconfig   clang
hexagon   allnoconfig   clang
hexagon  allyesconfig   clang
hexagon defconfig   clang
i386 allmodconfig   gcc  
i386  allnoconfig   gcc  
i386 allyesconfig   gcc  
i386 buildonly-randconfig-001-20240424   gcc  
i386 buildonly-randconfig-002-20240424   gcc  
i386 buildonly-randconfig-003-20240424   gcc  
i386 buildonly-randconfig-004-20240424   gcc  
i386 buildonly-randconfig-005-20240424   gcc  
i386 buildonly-randconfig-006-20240424   gcc  
i386defconfig   clang
i386  randconfig-001-20240424   gcc  
i386  randconfig-002-20240424   gcc  
i386  randconfig-003-20240424   gcc  
i386  randconfig-004-20240424   clang
i386  randconfig-005-20240424   gcc  
i386  randconfig-006-20240424   gcc  
i386  randconfig-011-20240424   clang
i386  randconfig-012-20240424   gcc  
i386  randconfig-013-20240424   clang
i386  randconfig-014-20240424   clang
i386  randconfig-015-20240424   clang
i386  randconfig-016-20240424   clang
loongarchallmodconfig   gcc  
loongarch allnoconfig   gcc  
loongarch   defconfig   gcc  
loongarch randconfig-001-20240424   gcc  
loongarch randconfig-002-20240424   gcc  
m68k allmodconfig   gcc  
m68k  allnoconfig   gcc  
m68k allyesconfig   gcc  
m68kdefconfig   gcc  
m68k   sun3_defconfig   gcc  
microblaze   allmodconfig   gcc  
microblazeallnoconfig   gcc  
microblaze   allyesconfig   gcc  
microblaze  defconfig   gcc  
mips  allnoconfig   gcc  
mips allyesconfig   gcc  
mips cobalt_defconfig   gcc  
mips   lemote2f_defconfig   gcc  
mips  malta_defconfig   gcc  
nios2allmodconfig   gcc  
nios2 allnoconfig   gcc  
nios2allyesconfig   gcc  
nios2   defconfig   gcc  
nios2 randconfig-001-20240424   gcc  
nios2 randconfig-002-20240424   gcc  
openrisc  allnoconfig   gcc  
openrisc

linux-next: boot failure after merge of the modules tree

2024-04-24 Thread Stephen Rothwell
Hi all,

After merging the modules tree, today's linux-next boot (powerpc
pseries_le_defconfig) failed like this:

BUG: Kernel NULL pointer dereference at 0x0030
Faulting instruction address: 0xc057a4ec
Oops: Kernel access of bad area, sig: 11 [#1]
LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc5-08179-ga5ea707d10dc #1
Hardware name: IBM pSeries (emulated by qemu) POWER8 (raw) 0x4d0200 0xf04 
of:SLOF,HEAD pSeries
NIP:  c057a4ec LR: c02cd32c CTR: c02cd304
REGS: c4997700 TRAP: 0380   Not tainted  (6.9.0-rc5-08179-ga5ea707d10dc)
MSR:  82009033   CR: 84002484  XER: 2000
CFAR: c02cd328 IRQMASK: 0 
GPR00: c02cd32c c49979a0 c163a500 0001 
GPR04: 0001 4000  2cc0 
GPR08: 0030 0100  2000 
GPR12: c02cd304 c2b7 c00c  
GPR16:     
GPR20:     
GPR24:   c2aa0940 c26c0a40 
GPR28: 0001 c02cd32c 0030 c27d0f78 
NIP [c057a4ec] execmem_alloc+0x5c/0x12c
LR [c02cd32c] alloc_insn_page+0x28/0x70
Call Trace:
[c4997a40] [c02cd32c] alloc_insn_page+0x28/0x70
[c4997a60] [c02d07a4] __get_insn_slot+0x1cc/0x29c
[c4997aa0] [c005c434] arch_prepare_kprobe+0xbc/0x31c
[c4997b20] [c02d1b40] register_kprobe+0x54c/0x878
[c4997b90] [c2018828] arch_init_kprobes+0x28/0x40
[c4997bb0] [c204b33c] init_kprobes+0x138/0x218
[c4997c30] [c0010da8] do_one_initcall+0x80/0x2f8
[c4997d00] [c2005aa8] kernel_init_freeable+0x1f8/0x520
[c4997de0] [c0011148] kernel_init+0x34/0x26c
[c4997e50] [c000debc] ret_from_kernel_user_thread+0x14/0x1c
--- interrupt: 0 at 0x0
Code: fbe1fff8 3940 38e02cc0 7c9c2378 7fa802a6 e8c91e48 f8010010 fb41ffd0 
39200100 fb61ffd8 f821ff61 7fc64214 <7ca6402a> eb5e0020 837e0028 e8de0008 
---[ end trace  ]---

note: swapper/0[1] exited with irqs disabled
Kernel panic - not syncing: Attempted to kill init! exitcode=0x000b

Bisected to commit

  18da532eefc8 ("mm/execmem, arch: convert remaining overrides of module_alloc 
to execmem")

I have used the modules tree from next-20240423 for today.

This is a qemu boot test using:

qemu-system-ppc64 -M pseries -cpu POWER8 -m 2G -vga none -nographic -kernel 
~/next/powerpc_pseries_le_defconfig/vmlinux -initrd ./ppc64le-rootfs.cpio.gz

-- 
Cheers,
Stephen Rothwell


pgpixcQhueaDW.pgp
Description: OpenPGP digital signature