Re: [PATCH] ibmvfc: Protect vhost->task_set increment by the host lock
On Wed, 16 Sep 2020 15:09:59 -0500, Brian King wrote: > In the discovery thread, ibmvfc does a vhost->task_set++ without > any lock held. This could result in two targets getting the same > cancel key, which could have strange effects in error recovery. > The actual probability of this occurring should be extremely > small, since this should all be done in a single threaded loop > from the discovery thread, but let's fix it up anyway to be safe. Applied to 5.10/scsi-queue, thanks! [1/1] scsi: ibmvfc: Protect vhost->task_set increment by the host lock https://git.kernel.org/mkp/scsi/c/2584e5aef87a -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v2 devicetree 0/2] Add Seville Ethernet switch to T1040RDB
Reviewed-by: Maxim Kochetkov 29.09.2020 14:32, Vladimir Oltean пишет: Seville is a DSA switch that is embedded inside the T1040 SoC, and supported by the mscc_seville DSA driver inside drivers/net/dsa/ocelot. This series adds this switch to the SoC's dtsi files and to the T1040RDB board file. Vladimir Oltean (2): powerpc: dts: t1040: add bindings for Seville Ethernet switch powerpc: dts: t1040rdb: add ports for Seville Ethernet switch arch/powerpc/boot/dts/fsl/t1040rdb.dts | 115 arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 76 + 2 files changed, 191 insertions(+)
Re: [PATCH v2 devicetree 2/2] powerpc: dts: t1040rdb: add ports for Seville Ethernet switch
Reviewed-by: Maxim Kochetkov 29.09.2020 14:32, Vladimir Oltean пишет: From: Vladimir Oltean Define the network interface names for the switch ports and hook them up to the 2 QSGMII PHYs that are onboard. A conscious decision was taken to go along with the numbers that are written on the front panel of the board and not with the hardware numbers of the switch chip ports. The 2 numbering schemes are shifted by 8. Signed-off-by: Vladimir Oltean --- Changes in v2: Use the existing way of accessing the mdio bus and not labels. arch/powerpc/boot/dts/fsl/t1040rdb.dts | 115 + 1 file changed, 115 insertions(+) diff --git a/arch/powerpc/boot/dts/fsl/t1040rdb.dts b/arch/powerpc/boot/dts/fsl/t1040rdb.dts index 65ff34c49025..3fd08a2b6dcb 100644 --- a/arch/powerpc/boot/dts/fsl/t1040rdb.dts +++ b/arch/powerpc/boot/dts/fsl/t1040rdb.dts @@ -64,6 +64,40 @@ mdio@fc000 { phy_sgmii_2: ethernet-phy@3 { reg = <0x03>; }; + + /* VSC8514 QSGMII PHY */ + phy_qsgmii_0: ethernet-phy@4 { + reg = <0x4>; + }; + + phy_qsgmii_1: ethernet-phy@5 { + reg = <0x5>; + }; + + phy_qsgmii_2: ethernet-phy@6 { + reg = <0x6>; + }; + + phy_qsgmii_3: ethernet-phy@7 { + reg = <0x7>; + }; + + /* VSC8514 QSGMII PHY */ + phy_qsgmii_4: ethernet-phy@8 { + reg = <0x8>; + }; + + phy_qsgmii_5: ethernet-phy@9 { + reg = <0x9>; + }; + + phy_qsgmii_6: ethernet-phy@a { + reg = <0xa>; + }; + + phy_qsgmii_7: ethernet-phy@b { + reg = <0xb>; + }; }; }; }; @@ -76,3 +110,84 @@ cpld@3,0 { }; #include "t1040si-post.dtsi" + +_switch { + status = "okay"; +}; + +_port0 { + managed = "in-band-status"; + phy-handle = <_qsgmii_0>; + phy-mode = "qsgmii"; + /* ETH4 written on chassis */ + label = "swp4"; + status = "okay"; +}; + +_port1 { + managed = "in-band-status"; + phy-handle = <_qsgmii_1>; + phy-mode = "qsgmii"; + /* ETH5 written on chassis */ + label = "swp5"; + status = "okay"; +}; + +_port2 { + managed = "in-band-status"; + phy-handle = <_qsgmii_2>; + phy-mode = "qsgmii"; + /* ETH6 written on chassis */ + label = "swp6"; + status = "okay"; +}; + +_port3 { + managed = "in-band-status"; + phy-handle = <_qsgmii_3>; + phy-mode = "qsgmii"; + /* ETH7 written on chassis */ + label = "swp7"; + status = "okay"; +}; + +_port4 { + managed = "in-band-status"; + phy-handle = <_qsgmii_4>; + phy-mode = "qsgmii"; + /* ETH8 written on chassis */ + label = "swp8"; + status = "okay"; +}; + +_port5 { + managed = "in-band-status"; + phy-handle = <_qsgmii_5>; + phy-mode = "qsgmii"; + /* ETH9 written on chassis */ + label = "swp9"; + status = "okay"; +}; + +_port6 { + managed = "in-band-status"; + phy-handle = <_qsgmii_6>; + phy-mode = "qsgmii"; + /* ETH10 written on chassis */ + label = "swp10"; + status = "okay"; +}; + +_port7 { + managed = "in-band-status"; + phy-handle = <_qsgmii_7>; + phy-mode = "qsgmii"; + /* ETH11 written on chassis */ + label = "swp11"; + status = "okay"; +}; + +_port8 { + ethernet = <>; + status = "okay"; +};
Re: [PATCH v2 devicetree 1/2] powerpc: dts: t1040: add bindings for Seville Ethernet switch
Reviewed-by: Maxim Kochetkov 29.09.2020 14:32, Vladimir Oltean пишет: Add the description of the embedded L2 switch inside the SoC dtsi file for NXP T1040. Signed-off-by: Vladimir Oltean --- Changes in v2: Make switch node disabled by default. arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 76 + 1 file changed, 76 insertions(+) diff --git a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi index 315d0557eefc..5cb90c66cd3f 100644 --- a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi @@ -628,6 +628,82 @@ mdio@fd000 { status = "disabled"; }; }; + + seville_switch: ethernet-switch@80 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,vsc9953-switch"; + reg = <0x80 0x29>; + little-endian; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + seville_port0: port@0 { + reg = <0>; + status = "disabled"; + }; + + seville_port1: port@1 { + reg = <1>; + status = "disabled"; + }; + + seville_port2: port@2 { + reg = <2>; + status = "disabled"; + }; + + seville_port3: port@3 { + reg = <3>; + status = "disabled"; + }; + + seville_port4: port@4 { + reg = <4>; + status = "disabled"; + }; + + seville_port5: port@5 { + reg = <5>; + status = "disabled"; + }; + + seville_port6: port@6 { + reg = <6>; + status = "disabled"; + }; + + seville_port7: port@7 { + reg = <7>; + status = "disabled"; + }; + + seville_port8: port@8 { + reg = <8>; + phy-mode = "internal"; + status = "disabled"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; + + seville_port9: port@9 { + reg = <9>; + phy-mode = "internal"; + status = "disabled"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; + }; + }; }; {
Re: [PATCH v2 4/7] powerpc: Remove PowerPC 601
On Tue, Sep 29, 2020 at 06:09:21AM +, Christophe Leroy wrote: > Powerpc 601 is 25 years old. So is 603, but that one is still used! :-) > It is not selected by any defconfig. > > It requires a lot of special handling as it deviates from the > standard 6xx. > > Retire it. That is fine with me of course. If I get a vote at all for this! Thanks, Segher
Re: [PATCH v2 devicetree 2/2] powerpc: dts: t1040rdb: add ports for Seville Ethernet switch
On Tue, Sep 29, 2020 at 10:10:48PM +0200, Andrew Lunn wrote: > On Tue, Sep 29, 2020 at 07:39:54PM +, Vladimir Oltean wrote: > > On Tue, Sep 29, 2020 at 09:11:53PM +0200, Andrew Lunn wrote: > > > > +_port0 { > > > > + managed = "in-band-status"; > > > > + phy-handle = <_qsgmii_0>; > > > > + phy-mode = "qsgmii"; > > > > + /* ETH4 written on chassis */ > > > > + label = "swp4"; > > > > > > If ETH4 is on the chassis why not use ETH4? > > > > You mean all-caps, just like that? > > Yes. > > DSA is often used in WiFI access point, etc. The user is not a > computer professional. If the WebGUI says ETH4, and the label on the > front says ETH4, they probably think the two are the same, and are > happy. > > I have one box which does not have an labels on the front panels, but > the industrial sockets for Ethernet are colour coded. So the interface > names are red, blue, green, to match the socket colour, and the cable > set is also colour coded the same. > > So long as it is unique, the kernel does not care. So make it easy for > the user. It would look like this: [root@T1040 ~] # ip link 1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: dummy0: mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/ether de:91:41:1a:92:b8 brd ff:ff:ff:ff:ff:ff 3: fm1-gb3: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:68 brd ff:ff:ff:ff:ff:ff 4: fm1-gb4: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:88 brd ff:ff:ff:ff:ff:ff 5: fm1-gb0: mtu 1504 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 6: fm1-gb1: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:28 brd ff:ff:ff:ff:ff:ff 7: fm1-gb2: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:48 brd ff:ff:ff:ff:ff:ff 8: tunl0@NONE: mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ipip 0.0.0.0 brd 0.0.0.0 9: sit0@NONE: mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 10: ETH4@fm1-gb0: mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 11: ETH5@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 12: ETH6@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 13: ETH7@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 14: ETH8@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 15: ETH9@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 16: ETH10@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff 17: ETH11@fm1-gb0: mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 00:1f:7b:6a:02:08 brd ff:ff:ff:ff:ff:ff [root@T1040 ~] # ip link set ETH4 down [ 94.942190] mscc_seville ffe80.ethernet-switch ETH4: Link is Down [root@T1040 ~] # ip link set ETH4 up [ 100.262533] mscc_seville ffe80.ethernet-switch ETH4: configuring for inband/qsgmii link mode [ 100.272122] 8021q: adding VLAN 0 to HW filter on device ETH4 [ 103.69] mscc_seville ffe80.ethernet-switch ETH4: Link is Up - 1Gbps/Full - flow control rx/tx [ 103.342697] IPv6: ADDRCONF(NETDEV_CHANGE): ETH4: link becomes ready I'm not in love, but I guess at least there won't be any doubt if they are named like this. I'm sending another revision with these names soon. Thanks, -Vladimir
Re: [PATCH v2 devicetree 2/2] powerpc: dts: t1040rdb: add ports for Seville Ethernet switch
On Tue, Sep 29, 2020 at 09:11:53PM +0200, Andrew Lunn wrote: > > +_port0 { > > + managed = "in-band-status"; > > + phy-handle = <_qsgmii_0>; > > + phy-mode = "qsgmii"; > > + /* ETH4 written on chassis */ > > + label = "swp4"; > > If ETH4 is on the chassis why not use ETH4? You mean all-caps, just like that? I don't know, I never saw an interface named in all-caps, it looks strange to me. I understand that board designers are typically case-insensitive, and that's kind of what my problem is, "eth4" is clashing with the default naming scheme of the kernel and I also want to avoid that. All in all, this is a reference design board, I don't care too much. I've seen the "swp" convention being quite frequent, and I thought that would be more intuitive. I've been using the same scheme (the switch ports starting from swp2, corresponding to ETH2 on the chassis) for the LS1021A-TSN board (arch/arm/boot/dts/ls1021a-tsn.dts) and my users haven't complained about it. Plus, it's not like the dpaa-eth (standalone) ports are named after the chassis labels. Freescale/NXP typically ships an udev rule file that names the interface after the associated FMan hardware port (for example, the DSA master for the switch on this SoC is called "fm1-gb0", and it's an internal port having nothing to do with ETH0, which is "fm1-gb3"). I think it's a bit strange that the Rest Of World doesn't allow interface naming via device tree, on this board the switch ports are not where the big interface naming problem is. Although I'm not even sure what to do to not increase it even more. With users being used to have ETH0 going to fm1-gb3, maybe naming ETH4 as swp4 isn't the brightest idea, true...
[PATCH v2 devicetree 2/2] powerpc: dts: t1040rdb: add ports for Seville Ethernet switch
From: Vladimir Oltean Define the network interface names for the switch ports and hook them up to the 2 QSGMII PHYs that are onboard. A conscious decision was taken to go along with the numbers that are written on the front panel of the board and not with the hardware numbers of the switch chip ports. The 2 numbering schemes are shifted by 8. Signed-off-by: Vladimir Oltean --- Changes in v2: Use the existing way of accessing the mdio bus and not labels. arch/powerpc/boot/dts/fsl/t1040rdb.dts | 115 + 1 file changed, 115 insertions(+) diff --git a/arch/powerpc/boot/dts/fsl/t1040rdb.dts b/arch/powerpc/boot/dts/fsl/t1040rdb.dts index 65ff34c49025..3fd08a2b6dcb 100644 --- a/arch/powerpc/boot/dts/fsl/t1040rdb.dts +++ b/arch/powerpc/boot/dts/fsl/t1040rdb.dts @@ -64,6 +64,40 @@ mdio@fc000 { phy_sgmii_2: ethernet-phy@3 { reg = <0x03>; }; + + /* VSC8514 QSGMII PHY */ + phy_qsgmii_0: ethernet-phy@4 { + reg = <0x4>; + }; + + phy_qsgmii_1: ethernet-phy@5 { + reg = <0x5>; + }; + + phy_qsgmii_2: ethernet-phy@6 { + reg = <0x6>; + }; + + phy_qsgmii_3: ethernet-phy@7 { + reg = <0x7>; + }; + + /* VSC8514 QSGMII PHY */ + phy_qsgmii_4: ethernet-phy@8 { + reg = <0x8>; + }; + + phy_qsgmii_5: ethernet-phy@9 { + reg = <0x9>; + }; + + phy_qsgmii_6: ethernet-phy@a { + reg = <0xa>; + }; + + phy_qsgmii_7: ethernet-phy@b { + reg = <0xb>; + }; }; }; }; @@ -76,3 +110,84 @@ cpld@3,0 { }; #include "t1040si-post.dtsi" + +_switch { + status = "okay"; +}; + +_port0 { + managed = "in-band-status"; + phy-handle = <_qsgmii_0>; + phy-mode = "qsgmii"; + /* ETH4 written on chassis */ + label = "swp4"; + status = "okay"; +}; + +_port1 { + managed = "in-band-status"; + phy-handle = <_qsgmii_1>; + phy-mode = "qsgmii"; + /* ETH5 written on chassis */ + label = "swp5"; + status = "okay"; +}; + +_port2 { + managed = "in-band-status"; + phy-handle = <_qsgmii_2>; + phy-mode = "qsgmii"; + /* ETH6 written on chassis */ + label = "swp6"; + status = "okay"; +}; + +_port3 { + managed = "in-band-status"; + phy-handle = <_qsgmii_3>; + phy-mode = "qsgmii"; + /* ETH7 written on chassis */ + label = "swp7"; + status = "okay"; +}; + +_port4 { + managed = "in-band-status"; + phy-handle = <_qsgmii_4>; + phy-mode = "qsgmii"; + /* ETH8 written on chassis */ + label = "swp8"; + status = "okay"; +}; + +_port5 { + managed = "in-band-status"; + phy-handle = <_qsgmii_5>; + phy-mode = "qsgmii"; + /* ETH9 written on chassis */ + label = "swp9"; + status = "okay"; +}; + +_port6 { + managed = "in-band-status"; + phy-handle = <_qsgmii_6>; + phy-mode = "qsgmii"; + /* ETH10 written on chassis */ + label = "swp10"; + status = "okay"; +}; + +_port7 { + managed = "in-band-status"; + phy-handle = <_qsgmii_7>; + phy-mode = "qsgmii"; + /* ETH11 written on chassis */ + label = "swp11"; + status = "okay"; +}; + +_port8 { + ethernet = <>; + status = "okay"; +}; -- 2.25.1
[PATCH v2 devicetree 1/2] powerpc: dts: t1040: add bindings for Seville Ethernet switch
Add the description of the embedded L2 switch inside the SoC dtsi file for NXP T1040. Signed-off-by: Vladimir Oltean --- Changes in v2: Make switch node disabled by default. arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 76 + 1 file changed, 76 insertions(+) diff --git a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi index 315d0557eefc..5cb90c66cd3f 100644 --- a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi @@ -628,6 +628,82 @@ mdio@fd000 { status = "disabled"; }; }; + + seville_switch: ethernet-switch@80 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,vsc9953-switch"; + reg = <0x80 0x29>; + little-endian; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + seville_port0: port@0 { + reg = <0>; + status = "disabled"; + }; + + seville_port1: port@1 { + reg = <1>; + status = "disabled"; + }; + + seville_port2: port@2 { + reg = <2>; + status = "disabled"; + }; + + seville_port3: port@3 { + reg = <3>; + status = "disabled"; + }; + + seville_port4: port@4 { + reg = <4>; + status = "disabled"; + }; + + seville_port5: port@5 { + reg = <5>; + status = "disabled"; + }; + + seville_port6: port@6 { + reg = <6>; + status = "disabled"; + }; + + seville_port7: port@7 { + reg = <7>; + status = "disabled"; + }; + + seville_port8: port@8 { + reg = <8>; + phy-mode = "internal"; + status = "disabled"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; + + seville_port9: port@9 { + reg = <9>; + phy-mode = "internal"; + status = "disabled"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; + }; + }; }; { -- 2.25.1
[PATCH v2 devicetree 0/2] Add Seville Ethernet switch to T1040RDB
Seville is a DSA switch that is embedded inside the T1040 SoC, and supported by the mscc_seville DSA driver inside drivers/net/dsa/ocelot. This series adds this switch to the SoC's dtsi files and to the T1040RDB board file. Vladimir Oltean (2): powerpc: dts: t1040: add bindings for Seville Ethernet switch powerpc: dts: t1040rdb: add ports for Seville Ethernet switch arch/powerpc/boot/dts/fsl/t1040rdb.dts | 115 arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 76 + 2 files changed, 191 insertions(+) -- 2.25.1
Re: [PATCH v2 14/14] powerpc/pseries/iommu: Rename "direct window" to "dma window"
On Tue, 2020-09-29 at 13:55 +1000, Alexey Kardashevskiy wrote: > > On 12/09/2020 03:07, Leonardo Bras wrote: > > Cc: linuxppc-dev@lists.ozlabs.org, linux-ker...@vger.kernel.org, > > > > A previous change introduced the usage of DDW as a bigger indirect DMA > > mapping when the DDW available size does not map the whole partition. > > > > As most of the code that manipulates direct mappings was reused for > > indirect mappings, it's necessary to rename all names and debug/info > > messages to reflect that it can be used for both kinds of mapping. > > > > Also, defines DEFAULT_DMA_WIN as "ibm,dma-window" to document that > > it's the name of the default DMA window. > > "ibm,dma-window" is so old so it does not need a macro (which btw would > be DMA_WIN_PROPNAME to match the other names) :) Thanks for bringing that to my attention! In fact, DMA_WIN_PROPNAME makes more sense, but it's still generic and doesn't look to point to a generic one. Would that be ok to call it DEFAULT_WIN_PROPNAME ? > > > > Those changes are not supposed to change how the code works in any > > way, just adjust naming. > > I simply have this in my .vimrc for the cases like this one: > > === > This should cause no behavioural change. > === Great tip! I will make sure to have this saved here :) Thank you!
Re: [PATCH v2 devicetree 2/2] powerpc: dts: t1040rdb: add ports for Seville Ethernet switch
On Tue, Sep 29, 2020 at 07:39:54PM +, Vladimir Oltean wrote: > On Tue, Sep 29, 2020 at 09:11:53PM +0200, Andrew Lunn wrote: > > > +_port0 { > > > + managed = "in-band-status"; > > > + phy-handle = <_qsgmii_0>; > > > + phy-mode = "qsgmii"; > > > + /* ETH4 written on chassis */ > > > + label = "swp4"; > > > > If ETH4 is on the chassis why not use ETH4? > > You mean all-caps, just like that? Yes. DSA is often used in WiFI access point, etc. The user is not a computer professional. If the WebGUI says ETH4, and the label on the front says ETH4, they probably think the two are the same, and are happy. I have one box which does not have an labels on the front panels, but the industrial sockets for Ethernet are colour coded. So the interface names are red, blue, green, to match the socket colour, and the cable set is also colour coded the same. So long as it is unique, the kernel does not care. So make it easy for the user. Andrew
Re: [PATCH v2 devicetree 2/2] powerpc: dts: t1040rdb: add ports for Seville Ethernet switch
> +_port0 { > + managed = "in-band-status"; > + phy-handle = <_qsgmii_0>; > + phy-mode = "qsgmii"; > + /* ETH4 written on chassis */ > + label = "swp4"; If ETH4 is on the chassis why not use ETH4? Andrew
Re: [PATCH v2 01/14] powerpc/pseries/iommu: Replace hard-coded page shift
On Tue, 2020-09-29 at 13:56 +1000, Alexey Kardashevskiy wrote: > > On 12/09/2020 03:07, Leonardo Bras wrote: > > Cc: linuxppc-dev@lists.ozlabs.org, linux-ker...@vger.kernel.org, > > These normally go right before "signed-off-by". > Yeah, it looks like something went wrong between git format-patch and git send-email. I will look for in in the next series. > > > Some functions assume IOMMU page size can only be 4K (pageshift == 12). > > Update them to accept any page size passed, so we can use 64K pages. > > > > In the process, some defines like TCE_SHIFT were made obsolete, and then > > removed. > > > > IODA3 Revision 3.0_prd1 (OpenPowerFoundation), Figures 3.4 and 3.5 show > > a RPN of 52-bit, and considers a 12-bit pageshift, so there should be > > no need of using TCE_RPN_MASK, which masks out any bit after 40 in rpn. > > It's usage removed from tce_build_pSeries(), tce_build_pSeriesLP(), and > > tce_buildmulti_pSeriesLP(). > > > > Most places had a tbl struct, so using tbl->it_page_shift was simple. > > tce_free_pSeriesLP() was a special case, since callers not always have a > > tbl struct, so adding a tceshift parameter seems the right thing to do. > > > > Signed-off-by: Leonardo Bras > > Reviewed-by: Alexey Kardashevskiy Thanks for reviewing! > > > > --- > > arch/powerpc/include/asm/tce.h | 8 -- > > arch/powerpc/platforms/pseries/iommu.c | 39 +++--- > > 2 files changed, 23 insertions(+), 24 deletions(-) > > > > diff --git a/arch/powerpc/include/asm/tce.h b/arch/powerpc/include/asm/tce.h > > index db5fc2f2262d..0c34d2756d92 100644 > > --- a/arch/powerpc/include/asm/tce.h > > +++ b/arch/powerpc/include/asm/tce.h > > @@ -19,15 +19,7 @@ > > #define TCE_VB0 > > #define TCE_PCI 1 > > > > -/* TCE page size is 4096 bytes (1 << 12) */ > > - > > -#define TCE_SHIFT 12 > > -#define TCE_PAGE_SIZE (1 << TCE_SHIFT) > > - > > #define TCE_ENTRY_SIZE8 /* each TCE is 64 bits > > */ > > - > > -#define TCE_RPN_MASK 0xfful /* 40-bit RPN (4K > > pages) */ > > -#define TCE_RPN_SHIFT 12 > > #define TCE_VALID 0x800 /* TCE valid */ > > #define TCE_ALLIO 0x400 /* TCE valid for all lpars */ > > #define TCE_PCI_WRITE 0x2 /* write from PCI > > allowed */ > > diff --git a/arch/powerpc/platforms/pseries/iommu.c > > b/arch/powerpc/platforms/pseries/iommu.c > > index e4198700ed1a..9db3927607a4 100644 > > --- a/arch/powerpc/platforms/pseries/iommu.c > > +++ b/arch/powerpc/platforms/pseries/iommu.c > > @@ -107,6 +107,8 @@ static int tce_build_pSeries(struct iommu_table *tbl, > > long index, > > u64 proto_tce; > > __be64 *tcep; > > u64 rpn; > > + const unsigned long tceshift = tbl->it_page_shift; > > + const unsigned long pagesize = IOMMU_PAGE_SIZE(tbl); > > > > proto_tce = TCE_PCI_READ; // Read allowed > > > > @@ -117,10 +119,10 @@ static int tce_build_pSeries(struct iommu_table *tbl, > > long index, > > > > while (npages--) { > > /* can't move this out since we might cross MEMBLOCK boundary */ > > - rpn = __pa(uaddr) >> TCE_SHIFT; > > - *tcep = cpu_to_be64(proto_tce | (rpn & TCE_RPN_MASK) << > > TCE_RPN_SHIFT); > > + rpn = __pa(uaddr) >> tceshift; > > + *tcep = cpu_to_be64(proto_tce | rpn << tceshift); > > > > - uaddr += TCE_PAGE_SIZE; > > + uaddr += pagesize; > > tcep++; > > } > > return 0; > > @@ -146,7 +148,7 @@ static unsigned long tce_get_pseries(struct iommu_table > > *tbl, long index) > > return be64_to_cpu(*tcep); > > } > > > > -static void tce_free_pSeriesLP(unsigned long liobn, long, long); > > +static void tce_free_pSeriesLP(unsigned long liobn, long, long, long); > > static void tce_freemulti_pSeriesLP(struct iommu_table*, long, long); > > > > static int tce_build_pSeriesLP(unsigned long liobn, long tcenum, long > > tceshift, > > @@ -166,12 +168,12 @@ static int tce_build_pSeriesLP(unsigned long liobn, > > long tcenum, long tceshift, > > proto_tce |= TCE_PCI_WRITE; > > > > while (npages--) { > > - tce = proto_tce | (rpn & TCE_RPN_MASK) << tceshift; > > + tce = proto_tce | rpn << tceshift; > > rc = plpar_tce_put((u64)liobn, (u64)tcenum << tceshift, tce); > > > > if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) { > > ret = (int)rc; > > - tce_free_pSeriesLP(liobn, tcenum_start, > > + tce_free_pSeriesLP(liobn, tcenum_start, tceshift, > >(npages_start - (npages + 1))); > > break; > > } > > @@ -205,10 +207,11 @@ static int tce_buildmulti_pSeriesLP(struct > > iommu_table *tbl, long tcenum, > > long tcenum_start = tcenum, npages_start = npages; > > int
Re: [PATCH] powerpc: net: bpf_jit_comp: Fix misuse of fallthrough
On 9/28/20 11:00 AM, zhe...@windriver.com wrote: From: He Zhe The user defined label following "fallthrough" is not considered by GCC and causes build failure. kernel-source/include/linux/compiler_attributes.h:208:41: error: attribute 'fallthrough' not preceding a case label or default label [-Werror] 208 define fallthrough _attribute((fallthrough_)) ^ Signed-off-by: He Zhe Applied, thanks! I've also added Fixes tag with df561f6688fe ("treewide: Use fallthrough pseudo-keyword") which added the bug.
Re: [PATCH v2 2/3] lkdtm/powerpc: Add SLB multihit test
Hello, On Fri, Sep 25, 2020 at 12:57:33PM -0700, Kees Cook wrote: > On Fri, Sep 25, 2020 at 04:01:22PM +0530, Ganesh Goudar wrote: > > Add support to inject slb multihit errors, to test machine > > check handling. > > Thank you for more tests in here! Thanks for working on integrating this. > > > > > Based on work by Mahesh Salgaonkar and Michal Suchánek. > > > > Cc: Mahesh Salgaonkar > > Cc: Michal Suchánek > > Should these be Co-developed-by: with S-o-b? I don't think I wrote any of this code. I packaged it for SUSE and maybe changed some constants based on test result discussion. I compared this code to my saved snapshots of past versions of the test module and this covers all the test cases I have. The only difference is that the development modules have verbose prints showing what's going on. It is true that without the verbose prints some explanatory comments could be helpful. Reviewed-by: Michal Suchánek > > > Signed-off-by: Ganesh Goudar > > --- > > drivers/misc/lkdtm/Makefile | 4 ++ > > drivers/misc/lkdtm/core.c| 3 + > > drivers/misc/lkdtm/lkdtm.h | 3 + > > drivers/misc/lkdtm/powerpc.c | 132 +++ > > 4 files changed, 142 insertions(+) > > create mode 100644 drivers/misc/lkdtm/powerpc.c > > > > diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile > > index c70b3822013f..6a82f407fbcd 100644 > > --- a/drivers/misc/lkdtm/Makefile > > +++ b/drivers/misc/lkdtm/Makefile > > @@ -11,6 +11,10 @@ lkdtm-$(CONFIG_LKDTM)+= usercopy.o > > lkdtm-$(CONFIG_LKDTM) += stackleak.o > > lkdtm-$(CONFIG_LKDTM) += cfi.o > > > > +ifeq ($(CONFIG_PPC64),y) > > +lkdtm-$(CONFIG_LKDTM) += powerpc.o > > +endif > > This can just be: > > lkdtm-$(CONFIG_PPC64) += powerpc.o > > > + > > KASAN_SANITIZE_stackleak.o := n > > KCOV_INSTRUMENT_rodata.o := n > > > > diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c > > index a5e344df9166..8d5db42baa90 100644 > > --- a/drivers/misc/lkdtm/core.c > > +++ b/drivers/misc/lkdtm/core.c > > @@ -178,6 +178,9 @@ static const struct crashtype crashtypes[] = { > > #ifdef CONFIG_X86_32 > > CRASHTYPE(DOUBLE_FAULT), > > #endif > > +#ifdef CONFIG_PPC64 > > + CRASHTYPE(PPC_SLB_MULTIHIT), > > +#endif > > }; > > > > > > diff --git a/drivers/misc/lkdtm/lkdtm.h b/drivers/misc/lkdtm/lkdtm.h > > index 8878538b2c13..b305bd511ee5 100644 > > --- a/drivers/misc/lkdtm/lkdtm.h > > +++ b/drivers/misc/lkdtm/lkdtm.h > > @@ -104,4 +104,7 @@ void lkdtm_STACKLEAK_ERASING(void); > > /* cfi.c */ > > void lkdtm_CFI_FORWARD_PROTO(void); > > > > +/* powerpc.c */ > > +void lkdtm_PPC_SLB_MULTIHIT(void); > > + > > #endif > > diff --git a/drivers/misc/lkdtm/powerpc.c b/drivers/misc/lkdtm/powerpc.c > > new file mode 100644 > > index ..d6db18444757 > > --- /dev/null > > +++ b/drivers/misc/lkdtm/powerpc.c > > @@ -0,0 +1,132 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > + > > Please #include "lkdtm.h" here to get the correct pr_fmt heading (and > any future header adjustments). > > > +#include > > +#include > > + > > +static inline unsigned long get_slb_index(void) > > +{ > > + unsigned long index; > > + > > + index = get_paca()->stab_rr; > > + > > + /* > > +* simple round-robin replacement of slb starting at SLB_NUM_BOLTED. > > +*/ > > + if (index < (mmu_slb_size - 1)) > > + index++; > > + else > > + index = SLB_NUM_BOLTED; > > + get_paca()->stab_rr = index; > > + return index; > > +} > > + > > +#define slb_esid_mask(ssize) \ > > + (((ssize) == MMU_SEGSIZE_256M) ? ESID_MASK : ESID_MASK_1T) > > + > > +static inline unsigned long mk_esid_data(unsigned long ea, int ssize, > > +unsigned long slot) > > +{ > > + return (ea & slb_esid_mask(ssize)) | SLB_ESID_V | slot; > > +} > > + > > +#define slb_vsid_shift(ssize) \ > > + ((ssize) == MMU_SEGSIZE_256M ? SLB_VSID_SHIFT : SLB_VSID_SHIFT_1T) > > + > > +static inline unsigned long mk_vsid_data(unsigned long ea, int ssize, > > +unsigned long flags) > > +{ > > + return (get_kernel_vsid(ea, ssize) << slb_vsid_shift(ssize)) | flags | > > + ((unsigned long)ssize << SLB_VSID_SSIZE_SHIFT); > > +} > > + > > +static void insert_slb_entry(char *p, int ssize) > > +{ > > + unsigned long flags, entry; > > + > > + flags = SLB_VSID_KERNEL | mmu_psize_defs[MMU_PAGE_64K].sllp; > > + preempt_disable(); > > + > > + entry = get_slb_index(); > > + asm volatile("slbmte %0,%1" : > > + : "r" (mk_vsid_data((unsigned long)p, ssize, flags)), > > + "r" (mk_esid_data((unsigned long)p, ssize, entry)) > > + : "memory"); > > + > > + entry = get_slb_index(); > > + asm volatile("slbmte %0,%1" : > > + : "r" (mk_vsid_data((unsigned long)p, ssize, flags)), > > + "r"
Re: [PATCH] linux: configure CONFIG_I2C_OPAL as in-built.
On 9/29/20 2:14 AM, Joel Stanley wrote: On Fri, 25 Sep 2020 at 18:19, Mimi Zohar wrote: Hi Nayna, On Wed, 2020-09-23 at 14:25 -0400, Nayna Jain wrote: Currently, skiroot_defconfig CONFIG_I2C_OPAL is built as a loadable module rather than builtin, even if CONFIG_I2C=y is defined. This results in a delay in the TPM initialization, causing IMA to go into TPM bypass mode. As a result, the IMA measurements are added to the measurement list, but do not extend the TPM. Because of this, it is impossible to verify or attest to the system's integrity, either from skiroot or the target Host OS. The patch description is good, but perhaps we could provide a bit more context before. The concept of trusted boot requires the measurement to be added to the measurement list and extend the TPM, prior to allowing access to the file. By allowing access to a file before its measurement is included in the measurement list and extended into the TPM PCR, a malicious file could potentially prevent its own measurement from being added. As the PCRs are tamper proof, measuring and extending the TPM prior to giving access to the file, guarantees that all file measurements are included in the measurement list, including the malicious file. IMA needs to be enabled before any files are accessed in order to verify a file's integrity and extend the TPM with the file measurement. Queueing file measurements breaks the measure and extend, before usage, trusted boot paradigm. The ima-evm-utils package includes a test for walking the IMA measurement list, calculating the expected TPM PCRs, and comparing the calculated PCR values with the physical TPM. Testing is important to ensure the TPM is initialized prior to IMA. Failure to validate the IMA measurement list may indicate IMA went into TPM bypass mode, like in this case. Thanks for the explanation Mimi. It's lucky that the TPM drivers can be loaded early enough! Should we add something like this to security/integrity/ima/Kconfig? select I2C_OPAL if PPC_POWERNV It's generally frowned upon to select user visible symbols, but IMA does this for the TCG options already. I think yes, but in drivers/i2c/Kconfig and not in IMA Kconfig. IMA is dependent on TPM, and it is specified in IMA Kconfig. TPM NUVOTON driver has its dependency on I2C, which is taken care in drivers/char/tpm/Kconfig It is I2C driver which is dependent on I2C_OPAL for its functioning on POWERNV Systems. Thanks & Regards, - Nayna
Re: [PATCH] linux: configure CONFIG_I2C_OPAL as in-built.
Hi Joel, On Tue, 2020-09-29 at 06:14 +, Joel Stanley wrote: > On Fri, 25 Sep 2020 at 18:19, Mimi Zohar wrote: > > > > Hi Nayna, > > > > On Wed, 2020-09-23 at 14:25 -0400, Nayna Jain wrote: > > > Currently, skiroot_defconfig CONFIG_I2C_OPAL is built as a loadable > > > module rather than builtin, even if CONFIG_I2C=y is defined. This > > > results in a delay in the TPM initialization, causing IMA to go into > > > TPM bypass mode. As a result, the IMA measurements are added to the > > > measurement list, but do not extend the TPM. Because of this, it is > > > impossible to verify or attest to the system's integrity, either from > > > skiroot or the target Host OS. > > > > The patch description is good, but perhaps we could provide a bit more > > context before. > > > > The concept of trusted boot requires the measurement to be added to the > > measurement list and extend the TPM, prior to allowing access to the > > file. By allowing access to a file before its measurement is included > > in the measurement list and extended into the TPM PCR, a malicious file > > could potentially prevent its own measurement from being added. As the > > PCRs are tamper proof, measuring and extending the TPM prior to giving > > access to the file, guarantees that all file measurements are included > > in the measurement list, including the malicious file. > > > > IMA needs to be enabled before any files are accessed in order to > > verify a file's integrity and extend the TPM with the file > > measurement. Queueing file measurements breaks the measure and extend, > > before usage, trusted boot paradigm. > > > > The ima-evm-utils package includes a test for walking the IMA > > measurement list, calculating the expected TPM PCRs, and comparing the > > calculated PCR values with the physical TPM. Testing is important to > > ensure the TPM is initialized prior to IMA. Failure to validate the > > IMA measurement list may indicate IMA went into TPM bypass mode, like > > in this case. > > Thanks for the explanation Mimi. It's lucky that the TPM drivers can > be loaded early enough! > > Should we add something like this to security/integrity/ima/Kconfig? > > select I2C_OPAL if PPC_POWERNV > > It's generally frowned upon to select user visible symbols, but IMA > does this for the TCG options already. The other examples enable the TPM. I2C_OPAL is dependent on I2C being builtin. I'm not sure if this select is complete, nor if this is where it belongs. Mimi
[PATCH -next] ASoC: fsl: imx-mc13783: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code shorter and cleaner. Signed-off-by: Qinglang Miao --- sound/soc/fsl/imx-mc13783.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sound/soc/fsl/imx-mc13783.c b/sound/soc/fsl/imx-mc13783.c index dd9c1ac81..d9dca7bbc 100644 --- a/sound/soc/fsl/imx-mc13783.c +++ b/sound/soc/fsl/imx-mc13783.c @@ -96,7 +96,7 @@ static int imx_mc13783_probe(struct platform_device *pdev) imx_mc13783.dev = >dev; - ret = snd_soc_register_card(_mc13783); + ret = devm_snd_soc_register_card(>dev, _mc13783); if (ret) { dev_err(>dev, "snd_soc_register_card failed (%d)\n", ret); @@ -140,19 +140,11 @@ static int imx_mc13783_probe(struct platform_device *pdev) return ret; } -static int imx_mc13783_remove(struct platform_device *pdev) -{ - snd_soc_unregister_card(_mc13783); - - return 0; -} - static struct platform_driver imx_mc13783_audio_driver = { .driver = { .name = "imx_mc13783", }, .probe = imx_mc13783_probe, - .remove = imx_mc13783_remove }; module_platform_driver(imx_mc13783_audio_driver); -- 2.23.0
RE: [PATCH v2 1/2] ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver
Hi Philipp, Thank you for your review, please check my comments inline. /Viorel > -Original Message- > From: Philipp Zabel [mailto:p...@pengutronix.de] > Sent: Tuesday, September 22, 2020 3:09 PM > To: Viorel Suman (OSS) > Cc: Liam Girdwood ; Mark Brown > ; Rob Herring ; Jaroslav Kysela > ; Takashi Iwai ; Timur Tabi > ; Nicolin Chen ; Xiubo Li > ; Fabio Estevam ; Shengjiu > Wang ; Viorel Suman ; > Matthias Schiffer ; Cosmin-Gabriel > Samoila ; alsa-de...@alsa-project.org; > devicet...@vger.kernel.org; linux-ker...@vger.kernel.org; linuxppc- > d...@lists.ozlabs.org; dl-linux-imx ; Viorel Suman > > Subject: Re: [PATCH v2 1/2] ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver > > On Mon, Sep 21, 2020 at 10:08:11PM +0300, Viorel Suman (OSS) wrote: > > From: Viorel Suman > > > > XCVR (Audio Transceiver) is a on-chip functional module found on > > i.MX8MP. It support HDMI2.1 eARC, HDMI1.4 ARC and SPDIF. > > > > Signed-off-by: Viorel Suman > > --- > > sound/soc/fsl/Kconfig| 10 + > > sound/soc/fsl/Makefile |2 + > > sound/soc/fsl/fsl_xcvr.c | 1343 > > ++ > > sound/soc/fsl/fsl_xcvr.h | 266 + > > 4 files changed, 1621 insertions(+) > > create mode 100644 sound/soc/fsl/fsl_xcvr.c create mode 100644 > > sound/soc/fsl/fsl_xcvr.h > > > > diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index > > 3f76ff7..d04b64d 100644 > > --- a/sound/soc/fsl/Kconfig > > +++ b/sound/soc/fsl/Kconfig > > @@ -95,6 +95,16 @@ config SND_SOC_FSL_EASRC > > destination sample rate. It is a new design module compare with the > > old ASRC. > > > > +config SND_SOC_FSL_XCVR > > + tristate "NXP Audio Transceiver (XCVR) module support" > > + select REGMAP_MMIO > > + select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n > > + select SND_SOC_GENERIC_DMAENGINE_PCM > > + help > > + Say Y if you want to add Audio Transceiver (XCVR) support for NXP > > + iMX CPUs. XCVR is a digital module that supports HDMI2.1 eARC, > > + HDMI1.4 ARC and SPDIF. > > + > > config SND_SOC_FSL_UTILS > > tristate > > > > diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile index > > b835eeb..1d2231f 100644 > > --- a/sound/soc/fsl/Makefile > > +++ b/sound/soc/fsl/Makefile > > @@ -25,6 +25,7 @@ snd-soc-fsl-utils-objs := fsl_utils.o > > snd-soc-fsl-dma-objs := fsl_dma.o snd-soc-fsl-mqs-objs := fsl_mqs.o > > snd-soc-fsl-easrc-objs := fsl_easrc.o > > +snd-soc-fsl-xcvr-objs := fsl_xcvr.o > > > > obj-$(CONFIG_SND_SOC_FSL_AUDMIX) += snd-soc-fsl-audmix.o > > obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o @@ > > -38,6 +39,7 @@ obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o > > obj-$(CONFIG_SND_SOC_FSL_MQS) += snd-soc-fsl-mqs.o > > obj-$(CONFIG_SND_SOC_FSL_EASRC) += snd-soc-fsl-easrc.o > > obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o > > +obj-$(CONFIG_SND_SOC_FSL_XCVR) += snd-soc-fsl-xcvr.o > > > > # MPC5200 Platform Support > > obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o diff --git > > a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c new file mode > > 100644 index ..7391bca > > --- /dev/null > > +++ b/sound/soc/fsl/fsl_xcvr.c > > @@ -0,0 +1,1343 @@ > [...] > > +static int fsl_xcvr_probe(struct platform_device *pdev) { > > + struct device *dev = >dev; > > + struct device_node *np = dev->of_node; > > + const struct of_device_id *of_id; > > + struct fsl_xcvr *xcvr; > > + struct resource *ram_res, *regs_res, *rx_res, *tx_res; > > + void __iomem *regs; > > + int ret, irq; > > + > > + of_id = of_match_device(fsl_xcvr_dt_ids, dev); > > + if (!of_id) > > + return -EINVAL; > > + > > + xcvr = devm_kzalloc(dev, sizeof(*xcvr), GFP_KERNEL); > > + if (!xcvr) > > + return -ENOMEM; > > + > > + xcvr->pdev = pdev; > > + xcvr->ipg_clk = devm_clk_get(dev, "ipg"); > > + if (IS_ERR(xcvr->ipg_clk)) { > > + dev_err(dev, "failed to get ipg clock\n"); > > + return PTR_ERR(xcvr->ipg_clk); > > + } > > + > > + xcvr->phy_clk = devm_clk_get(dev, "phy"); > > + if (IS_ERR(xcvr->phy_clk)) { > > + dev_err(dev, "failed to get phy clock\n"); > > + return PTR_ERR(xcvr->phy_clk); > > + } > > + > > + xcvr->spba_clk = devm_clk_get(dev, "spba"); > > + if (IS_ERR(xcvr->spba_clk)) { > > + dev_err(dev, "failed to get spba clock\n"); > > + return PTR_ERR(xcvr->spba_clk); > > + } > > + > > + xcvr->pll_ipg_clk = devm_clk_get(dev, "pll_ipg"); > > + if (IS_ERR(xcvr->pll_ipg_clk)) { > > + dev_err(dev, "failed to get pll_ipg clock\n"); > > + return PTR_ERR(xcvr->pll_ipg_clk); > > + } > > + > > + ram_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > "ram"); > > + xcvr->ram_addr = devm_ioremap_resource(dev, ram_res); > > + if (IS_ERR(xcvr->ram_addr)) > > + return PTR_ERR(xcvr->ram_addr); > > + > > + regs_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > "regs"); > > +
[PATCH v3 2/2] ASoC: dt-bindings: fsl_xcvr: Add document for XCVR
From: Viorel Suman XCVR (Audio Transceiver) is a new IP module found on i.MX8MP. Signed-off-by: Viorel Suman --- .../devicetree/bindings/sound/fsl,xcvr.yaml| 103 + 1 file changed, 103 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,xcvr.yaml diff --git a/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml b/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml new file mode 100644 index ..8abab2d --- /dev/null +++ b/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml @@ -0,0 +1,103 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/fsl,xcvr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Audio Transceiver (XCVR) Controller + +maintainers: + - Viorel Suman + +properties: + $nodename: +pattern: "^xcvr@.*" + + compatible: +const: fsl,imx8mp-xcvr + + reg: +items: + - description: 20K RAM for code and data + - description: registers space + - description: RX FIFO address + - description: TX FIFO address + + reg-names: +items: + - const: ram + - const: regs + - const: rxfifo + - const: txfifo + + interrupts: +maxItems: 1 + + clocks: +items: + - description: Peripheral clock + - description: PHY clock + - description: SPBA clock + - description: PLL clock + + clock-names: +items: + - const: ipg + - const: phy + - const: spba + - const: pll_ipg + + dmas: +maxItems: 2 + + dma-names: +items: + - const: rx + - const: tx + + firmware-name: +$ref: /schemas/types.yaml#/definitions/string +const: imx/xcvr/xcvr-imx8mp.bin +description: | + Should contain the name of the default firmware image + file located on the firmware search path + + resets: +maxItems: 1 + +required: + - compatible + - reg + - reg-names + - interrupts + - clocks + - clock-names + - dmas + - dma-names + - firmware-name + - resets + +examples: + - | +#include +#include +#include + +xcvr: xcvr@30cc { + compatible = "fsl,imx8mp-xcvr"; + reg = <0x30cc 0x800>, + <0x30cc0800 0x400>, + <0x30cc0c00 0x080>, + <0x30cc0e00 0x080>; + reg-names = "ram", "regs", "rxfifo", "txfifo"; + interrupts = <0x0 128 IRQ_TYPE_LEVEL_HIGH>; + clocks = <_clk IMX8MP_CLK_AUDIOMIX_EARC_IPG>, +<_clk IMX8MP_CLK_AUDIOMIX_EARC_PHY>, +<_clk IMX8MP_CLK_AUDIOMIX_SPBA2_ROOT>, +<_clk IMX8MP_CLK_AUDIOMIX_AUDPLL_ROOT>; + clock-names = "ipg", "phy", "spba", "pll_ipg"; + dmas = < 30 2 0>, < 31 2 0>; + dma-names = "rx", "tx"; + firmware-name = "imx/xcvr/xcvr-imx8mp.bin"; + resets = <_reset 0>; +}; -- 2.7.4
[PATCH v3 1/2] ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver
From: Viorel Suman XCVR (Audio Transceiver) is a on-chip functional module found on i.MX8MP. It support HDMI2.1 eARC, HDMI1.4 ARC and SPDIF. Signed-off-by: Viorel Suman --- sound/soc/fsl/Kconfig| 10 + sound/soc/fsl/Makefile |2 + sound/soc/fsl/fsl_xcvr.c | 1356 ++ sound/soc/fsl/fsl_xcvr.h | 266 + 4 files changed, 1634 insertions(+) create mode 100644 sound/soc/fsl/fsl_xcvr.c create mode 100644 sound/soc/fsl/fsl_xcvr.h diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 3f76ff7..d04b64d 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig @@ -95,6 +95,16 @@ config SND_SOC_FSL_EASRC destination sample rate. It is a new design module compare with the old ASRC. +config SND_SOC_FSL_XCVR + tristate "NXP Audio Transceiver (XCVR) module support" + select REGMAP_MMIO + select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n + select SND_SOC_GENERIC_DMAENGINE_PCM + help + Say Y if you want to add Audio Transceiver (XCVR) support for NXP + iMX CPUs. XCVR is a digital module that supports HDMI2.1 eARC, + HDMI1.4 ARC and SPDIF. + config SND_SOC_FSL_UTILS tristate diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile index b835eeb..1d2231f 100644 --- a/sound/soc/fsl/Makefile +++ b/sound/soc/fsl/Makefile @@ -25,6 +25,7 @@ snd-soc-fsl-utils-objs := fsl_utils.o snd-soc-fsl-dma-objs := fsl_dma.o snd-soc-fsl-mqs-objs := fsl_mqs.o snd-soc-fsl-easrc-objs := fsl_easrc.o +snd-soc-fsl-xcvr-objs := fsl_xcvr.o obj-$(CONFIG_SND_SOC_FSL_AUDMIX) += snd-soc-fsl-audmix.o obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o @@ -38,6 +39,7 @@ obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o obj-$(CONFIG_SND_SOC_FSL_MQS) += snd-soc-fsl-mqs.o obj-$(CONFIG_SND_SOC_FSL_EASRC) += snd-soc-fsl-easrc.o obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o +obj-$(CONFIG_SND_SOC_FSL_XCVR) += snd-soc-fsl-xcvr.o # MPC5200 Platform Support obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c new file mode 100644 index ..148bf48 --- /dev/null +++ b/sound/soc/fsl/fsl_xcvr.c @@ -0,0 +1,1356 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright 2019 NXP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fsl_xcvr.h" +#include "imx-pcm.h" + +#define FSL_XCVR_CAPDS_SIZE256 + +struct fsl_xcvr { + struct platform_device *pdev; + struct regmap *regmap; + struct clk *ipg_clk; + struct clk *pll_ipg_clk; + struct clk *phy_clk; + struct clk *spba_clk; + struct reset_control *reset; + const char *fw_name; + u8 streams; + u32 mode; + u32 arc_mode; + void __iomem *ram_addr; + struct snd_dmaengine_dai_dma_data dma_prms_rx; + struct snd_dmaengine_dai_dma_data dma_prms_tx; + struct snd_aes_iec958 rx_iec958; + struct snd_aes_iec958 tx_iec958; + u8 cap_ds[FSL_XCVR_CAPDS_SIZE]; +}; + +static const struct fsl_xcvr_pll_conf { + u8 mfi; /* min=0x18, max=0x38 */ + u32 mfn; /* signed int, 2's compl., min=0x3FFF, max=0x0001 */ + u32 mfd; /* unsigned int */ + u32 fout; /* Fout = Fref*(MFI + MFN/MFD), Fref is 24MHz */ +} fsl_xcvr_pll_cfg[] = { + { .mfi = 54, .mfn = 1, .mfd = 6, .fout = 13, }, /* 1.3 GHz */ + { .mfi = 32, .mfn = 96, .mfd = 125, .fout = 786432000, }, /* 8000 Hz */ + { .mfi = 30, .mfn = 66, .mfd = 625, .fout = 722534400, }, /* 11025 Hz */ + { .mfi = 29, .mfn = 1, .mfd = 6, .fout = 7, }, /* 700 MHz */ +}; + +/* + * HDMI2.1 spec defines 6- and 12-channels layout for one bit audio + * stream. Todo: to check how this case can be considered below + */ +static const u32 fsl_xcvr_earc_channels[] = { 1, 2, 8, 16, 32, }; +static const struct snd_pcm_hw_constraint_list fsl_xcvr_earc_channels_constr = { + .count = ARRAY_SIZE(fsl_xcvr_earc_channels), + .list = fsl_xcvr_earc_channels, +}; + +static const u32 fsl_xcvr_earc_rates[] = { + 32000, 44100, 48000, 64000, 88200, 96000, + 128000, 176400, 192000, 256000, 352800, 384000, + 512000, 705600, 768000, 1024000, 1411200, 1536000, +}; +static const struct snd_pcm_hw_constraint_list fsl_xcvr_earc_rates_constr = { + .count = ARRAY_SIZE(fsl_xcvr_earc_rates), + .list = fsl_xcvr_earc_rates, +}; + +static const u32 fsl_xcvr_spdif_channels[] = { 2, }; +static const struct snd_pcm_hw_constraint_list fsl_xcvr_spdif_channels_constr = { + .count = ARRAY_SIZE(fsl_xcvr_spdif_channels), + .list = fsl_xcvr_spdif_channels, +}; + +static const u32 fsl_xcvr_spdif_rates[] = { + 32000, 44100, 48000, 88200, 96000, 176400, 192000, +}; +static const struct snd_pcm_hw_constraint_list fsl_xcvr_spdif_rates_constr = { + .count =
[PATCH v3 0/2] DAI driver for new XCVR IP
From: Viorel Suman DAI driver for new XCVR IP found in i.MX8MP. Viorel Suman (2): ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver ASoC: dt-bindings: fsl_xcvr: Add document for XCVR Changes since v1: - improved 6- and 12-ch layout comment - used regmap polling function, improved clocks handling in runtime_resume - added FW size check in FW load function, improved IRQ handler, removed dummy IRQ handlers - fixed yaml file Changes since v2: - used devm_reset_control_get_exclusive instead of of_reset_control_get - moved reset_control_assert into runtime_suspend .../devicetree/bindings/sound/fsl,xcvr.yaml| 103 ++ sound/soc/fsl/Kconfig | 10 + sound/soc/fsl/Makefile |2 + sound/soc/fsl/fsl_xcvr.c | 1356 sound/soc/fsl/fsl_xcvr.h | 266 5 files changed, 1737 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,xcvr.yaml create mode 100644 sound/soc/fsl/fsl_xcvr.c create mode 100644 sound/soc/fsl/fsl_xcvr.h -- 2.7.4
[PATCH v3 5/5] arm: dts: ls1021a: fix rcpm failed to claim resource
The range of dcfg reg is wrong, which overlap with other device, such as rcpm. This issue causing rcpm driver failed to claim reg resource when calling devm_ioremap_resource(). Signed-off-by: Ran Wang Acked-by: Li Yang --- Change in v3: - None Change in v2: - None arch/arm/boot/dts/ls1021a.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi index cb95964..9e588ad 100644 --- a/arch/arm/boot/dts/ls1021a.dtsi +++ b/arch/arm/boot/dts/ls1021a.dtsi @@ -173,7 +173,7 @@ dcfg: dcfg@1ee { compatible = "fsl,ls1021a-dcfg", "syscon"; - reg = <0x0 0x1ee 0x0 0x1>; + reg = <0x0 0x1ee 0x0 0x1000>; big-endian; }; -- 2.7.4
[PATCH v3 2/5] soc: fsl: handle RCPM errata A-008646 on SoC LS1021A
From: Biwen Li Hardware issue: - Reading register RCPM_IPPDEXPCR1 always return zero, this causes system firmware could not get correct information and wrongly do clock gating for all wakeup source IP during system suspend. Then those IPs will never get chance to wake system. Workaround: - Copy register RCPM_IPPDEXPCR1's setting to register SCFG_SPARECR8 to allow system firmware's psci method read it and do things accordingly. Signed-off-by: Biwen Li Signed-off-by: Ran Wang --- Change in v3: - Add copy_ippdexpcr1_setting(), simplize workaournd's implementation according to binding update. - Minor update on commit message. Change in v2: - Update commit message to be more clear. - Replace device_property_read_u32_array() with syscon_regmap_lookup_by_phandle_args() to make code simpler. drivers/soc/fsl/rcpm.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/rcpm.c b/drivers/soc/fsl/rcpm.c index a093dbe..4ac2a77 100644 --- a/drivers/soc/fsl/rcpm.c +++ b/drivers/soc/fsl/rcpm.c @@ -2,7 +2,7 @@ // // rcpm.c - Freescale QorIQ RCPM driver // -// Copyright 2019 NXP +// Copyright 2019-2020 NXP // // Author: Ran Wang @@ -22,6 +22,28 @@ struct rcpm { boollittle_endian; }; +#define SCFG_SPARECR8 0x051c + +static void copy_ippdexpcr1_setting(u32 val) +{ + struct device_node *np; + void __iomem *regs; + u32 reg_val; + + np = of_find_compatible_node(NULL, NULL, "fsl,ls1021a-scfg"); + if (!np) + return; + + regs = of_iomap(np, 0); + if (!regs) + return; + + reg_val = ioread32be(regs + SCFG_SPARECR8); + iowrite32be(val | reg_val, regs + SCFG_SPARECR8); + + iounmap(regs); +} + /** * rcpm_pm_prepare - performs device-level tasks associated with power * management, such as programming related to the wakeup source control. @@ -90,6 +112,17 @@ static int rcpm_pm_prepare(struct device *dev) tmp |= ioread32be(address); iowrite32be(tmp, address); } + /* +* Workaround of errata A-008646 on SoC LS1021A: +* There is a bug of register ippdexpcr1. +* Reading configuration register RCPM_IPPDEXPCR1 +* always return zero. So save ippdexpcr1's value +* to register SCFG_SPARECR8.And the value of +* ippdexpcr1 will be read from SCFG_SPARECR8. +*/ + if (dev_of_node(dev) && (i == 1)) + if (device_property_read_bool(dev, "fsl,ippdexpcr1-alt-reg")) + copy_ippdexpcr1_setting(tmp); } return 0; -- 2.7.4
[PATCH v3 1/5] Documentation: dt: binding: fsl: Add 'fsl, ippdexpcr1-alt-reg' property
From: Biwen Li The 'fsl,ippdexpcr1-alt-reg' property is used to handle an errata A-008646 on LS1021A. Signed-off-by: Biwen Li Signed-off-by: Ran Wang --- Change in v3: - Simplize related proterty definition and rename it. Change in v2: - None Documentation/devicetree/bindings/soc/fsl/rcpm.txt | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/fsl/rcpm.txt b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt index 5a33619..62a22fc 100644 --- a/Documentation/devicetree/bindings/soc/fsl/rcpm.txt +++ b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt @@ -34,6 +34,9 @@ Chassis Version Example Chips Optional properties: - little-endian : RCPM register block is Little Endian. Without it RCPM will be Big Endian (default case). + - fsl,ippdexpcr1-alt-reg : The property is trying to workaround a + hardware issue (found on SoC LS1021A only), if pressent, RCPM driver + will use SCFG_SPARECR8 as a shadow register for RCPM_IPPDEXPCR1. Example: The RCPM node for T4240: @@ -43,6 +46,15 @@ The RCPM node for T4240: #fsl,rcpm-wakeup-cells = <2>; }; +The RCPM node for LS1021A: + rcpm: rcpm@1ee2140 { + compatible = "fsl,ls1021a-rcpm", "fsl,qoriq-rcpm-2.1+"; + reg = <0x0 0x1ee2140 0x0 0x8>; + #fsl,rcpm-wakeup-cells = <2>; + fsl,ippdexpcr1-alt-reg; + }; + + * Freescale RCPM Wakeup Source Device Tree Bindings --- Required fsl,rcpm-wakeup property should be added to a device node if the device -- 2.7.4
[PATCH v3 4/5] arm: dts: ls1021a: fix flextimer failed to wake system
The data of property 'fsl,rcpm-wakeup' is not corrcet, which causing RCPM driver incorrectly program register IPPDEXPCR1, then flextimer is wrongly clock gated during system suspend, can't send interrupt to wake. Signed-off-by: Ran Wang Acked-by: Li Yang --- Change in v3: - None Change in v2: - None arch/arm/boot/dts/ls1021a.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi index 98b597e..cb95964 100644 --- a/arch/arm/boot/dts/ls1021a.dtsi +++ b/arch/arm/boot/dts/ls1021a.dtsi @@ -1014,7 +1014,7 @@ compatible = "fsl,ls1021a-ftm-alarm"; reg = <0x0 0x29d 0x0 0x1>; reg-names = "ftm"; - fsl,rcpm-wakeup = < 0x2 0x0>; + fsl,rcpm-wakeup = < 0x0 0x2000>; interrupts = ; big-endian; }; -- 2.7.4
[PATCH v3 3/5] arm: dts: ls1021a: enable RCPM workaround for erratum A-008646
From: Biwen Li The patch fixes a bug that FlexTimer cannot wakeup system in deep sleep. Signed-off-by: Biwen Li Signed-off-by: Ran Wang --- Change in v3: - Update proterty according to binding and driver change. Change in v2: - Change subject of commit message to be consistent with other related patches. arch/arm/boot/dts/ls1021a.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi index 827373e..98b597e 100644 --- a/arch/arm/boot/dts/ls1021a.dtsi +++ b/arch/arm/boot/dts/ls1021a.dtsi @@ -1007,6 +1007,7 @@ compatible = "fsl,ls1021a-rcpm", "fsl,qoriq-rcpm-2.1+"; reg = <0x0 0x1ee2140 0x0 0x8>; #fsl,rcpm-wakeup-cells = <2>; + fsl,ippdexpcr1-alt-reg; }; ftm_alarm0: timer0@29d { -- 2.7.4
[PATCH v12 5/5] powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32
Provides __kernel_clock_gettime64() on vdso32. This is the 64 bits version of __kernel_clock_gettime() which is y2038 compliant. Signed-off-by: Christophe Leroy --- v12: Added missing prototype --- arch/powerpc/include/asm/vdso/gettimeofday.h | 2 ++ arch/powerpc/kernel/vdso32/gettimeofday.S| 9 + arch/powerpc/kernel/vdso32/vdso32.lds.S | 1 + arch/powerpc/kernel/vdso32/vgettimeofday.c | 6 ++ 4 files changed, 18 insertions(+) diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h index 59a609a48b63..8da84722729b 100644 --- a/arch/powerpc/include/asm/vdso/gettimeofday.h +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h @@ -186,6 +186,8 @@ int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res, #else int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts, const struct vdso_data *vd); +int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts, + const struct vdso_data *vd); int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res, const struct vdso_data *vd); #endif diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S index fd7b01c51281..a6e29f880e0e 100644 --- a/arch/powerpc/kernel/vdso32/gettimeofday.S +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S @@ -35,6 +35,15 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) cvdso_call __c_kernel_clock_gettime V_FUNCTION_END(__kernel_clock_gettime) +/* + * Exact prototype of clock_gettime64() + * + * int __kernel_clock_gettime64(clockid_t clock_id, struct __timespec64 *ts); + * + */ +V_FUNCTION_BEGIN(__kernel_clock_gettime64) + cvdso_call __c_kernel_clock_gettime64 +V_FUNCTION_END(__kernel_clock_gettime64) /* * Exact prototype of clock_getres() diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S index 5206c2eb2a1d..af5812ca5dce 100644 --- a/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S @@ -147,6 +147,7 @@ VERSION #ifndef CONFIG_PPC_BOOK3S_601 __kernel_gettimeofday; __kernel_clock_gettime; + __kernel_clock_gettime64; __kernel_clock_getres; __kernel_time; __kernel_get_tbfreq; diff --git a/arch/powerpc/kernel/vdso32/vgettimeofday.c b/arch/powerpc/kernel/vdso32/vgettimeofday.c index 0b9ab4c22ef2..f7f71fecf4ed 100644 --- a/arch/powerpc/kernel/vdso32/vgettimeofday.c +++ b/arch/powerpc/kernel/vdso32/vgettimeofday.c @@ -11,6 +11,12 @@ int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts, return __cvdso_clock_gettime32_data(vd, clock, ts); } +int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts, + const struct vdso_data *vd) +{ + return __cvdso_clock_gettime_data(vd, clock, ts); +} + int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz, const struct vdso_data *vd) { -- 2.25.0
[PATCH v12 0/5] powerpc: switch VDSO to C implementation
This is a series to switch powerpc VDSO to generic C implementation. Changes in v12: - Rebased to today's powerpc/merge branch (Conflicts on VDSO Makefiles) - Added missing prototype for __kernel_clock_gettime64() Changes in v11: - Rebased to today's powerpc/merge branch - Prototype of __arch_get_hw_counter() was modified in mainline (patch 2) Changes in v10 are: - Added a comment explaining the reason for the double stack frame - Moved back .cfi_register lr next to mflr Main changes in v9 are: - Dropped the patches which put the VDSO datapage in front of VDSO text in the mapping - Adds a second stack frame because the caller doesn't set one, at least on PPC64 - Saving the TOC pointer on PPC64 (is that really needed ?) This series applies on today's powerpc/merge branch. See the last patches for details on changes and performance. Christophe Leroy (5): powerpc/processor: Move cpu_relax() into asm/vdso/processor.h powerpc/vdso: Prepare for switching VDSO to generic C implementation. powerpc/vdso: Save and restore TOC pointer on PPC64 powerpc/vdso: Switch VDSO to generic C implementation. powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32 arch/powerpc/Kconfig | 2 + arch/powerpc/include/asm/clocksource.h | 7 + arch/powerpc/include/asm/processor.h | 13 +- arch/powerpc/include/asm/vdso/clocksource.h | 7 + arch/powerpc/include/asm/vdso/gettimeofday.h | 200 + arch/powerpc/include/asm/vdso/processor.h| 23 ++ arch/powerpc/include/asm/vdso/vsyscall.h | 25 ++ arch/powerpc/include/asm/vdso_datapage.h | 40 +-- arch/powerpc/kernel/asm-offsets.c| 49 +-- arch/powerpc/kernel/time.c | 91 +- arch/powerpc/kernel/vdso.c | 5 +- arch/powerpc/kernel/vdso32/Makefile | 32 +- arch/powerpc/kernel/vdso32/config-fake32.h | 34 +++ arch/powerpc/kernel/vdso32/gettimeofday.S| 300 +-- arch/powerpc/kernel/vdso32/vdso32.lds.S | 1 + arch/powerpc/kernel/vdso32/vgettimeofday.c | 35 +++ arch/powerpc/kernel/vdso64/Makefile | 23 +- arch/powerpc/kernel/vdso64/gettimeofday.S| 242 +-- arch/powerpc/kernel/vdso64/vgettimeofday.c | 29 ++ 19 files changed, 456 insertions(+), 702 deletions(-) create mode 100644 arch/powerpc/include/asm/clocksource.h create mode 100644 arch/powerpc/include/asm/vdso/clocksource.h create mode 100644 arch/powerpc/include/asm/vdso/gettimeofday.h create mode 100644 arch/powerpc/include/asm/vdso/processor.h create mode 100644 arch/powerpc/include/asm/vdso/vsyscall.h create mode 100644 arch/powerpc/kernel/vdso32/config-fake32.h create mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c create mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c -- 2.25.0
[PATCH v12 4/5] powerpc/vdso: Switch VDSO to generic C implementation.
For VDSO32 on PPC64, we create a fake 32 bits config, on the same principle as MIPS architecture, in order to get the correct parts of the different asm header files. With the C VDSO, the performance is slightly lower, but it is worth it as it will ease maintenance and evolution, and also brings clocks that are not supported with the ASM VDSO. On an 8xx at 132 MHz, vdsotest with the ASM VDSO: gettimeofday:vdso: 828 nsec/call clock-getres-realtime-coarse:vdso: 391 nsec/call clock-gettime-realtime-coarse:vdso: 614 nsec/call clock-getres-realtime:vdso: 460 nsec/call clock-gettime-realtime:vdso: 876 nsec/call clock-getres-monotonic-coarse:vdso: 399 nsec/call clock-gettime-monotonic-coarse:vdso: 691 nsec/call clock-getres-monotonic:vdso: 460 nsec/call clock-gettime-monotonic:vdso: 1026 nsec/call On an 8xx at 132 MHz, vdsotest with the C VDSO: gettimeofday:vdso: 955 nsec/call clock-getres-realtime-coarse:vdso: 545 nsec/call clock-gettime-realtime-coarse:vdso: 592 nsec/call clock-getres-realtime:vdso: 545 nsec/call clock-gettime-realtime:vdso: 941 nsec/call clock-getres-monotonic-coarse:vdso: 545 nsec/call clock-gettime-monotonic-coarse:vdso: 591 nsec/call clock-getres-monotonic:vdso: 545 nsec/call clock-gettime-monotonic:vdso: 940 nsec/call It is even better for gettime with monotonic clocks. Unsupported clocks with ASM VDSO: clock-gettime-boottime:vdso: 3851 nsec/call clock-gettime-tai:vdso: 3852 nsec/call clock-gettime-monotonic-raw:vdso: 3396 nsec/call Same clocks with C VDSO: clock-gettime-tai:vdso: 941 nsec/call clock-gettime-monotonic-raw:vdso: 1001 nsec/call clock-gettime-monotonic-coarse:vdso: 591 nsec/call On an 8321E at 333 MHz, vdsotest with the ASM VDSO: gettimeofday:vdso: 220 nsec/call clock-getres-realtime-coarse:vdso: 102 nsec/call clock-gettime-realtime-coarse:vdso: 178 nsec/call clock-getres-realtime:vdso: 129 nsec/call clock-gettime-realtime:vdso: 235 nsec/call clock-getres-monotonic-coarse:vdso: 105 nsec/call clock-gettime-monotonic-coarse:vdso: 208 nsec/call clock-getres-monotonic:vdso: 129 nsec/call clock-gettime-monotonic:vdso: 274 nsec/call On an 8321E at 333 MHz, vdsotest with the C VDSO: gettimeofday:vdso: 272 nsec/call clock-getres-realtime-coarse:vdso: 160 nsec/call clock-gettime-realtime-coarse:vdso: 184 nsec/call clock-getres-realtime:vdso: 166 nsec/call clock-gettime-realtime:vdso: 281 nsec/call clock-getres-monotonic-coarse:vdso: 160 nsec/call clock-gettime-monotonic-coarse:vdso: 184 nsec/call clock-getres-monotonic:vdso: 169 nsec/call clock-gettime-monotonic:vdso: 275 nsec/call Signed-off-by: Christophe Leroy --- v12: - Rebased (Impact on arch/powerpc/kernel/vdso??/Makefile) v9: - Rebased (Impact on arch/powerpc/kernel/vdso??/Makefile v7: - Split out preparatory changes in a new preceding patch - Added -fasynchronous-unwind-tables to CC flags. v6: - Added missing prototypes in asm/vdso/gettimeofday.h for __c_kernel_ functions. - Using STACK_FRAME_OVERHEAD instead of INT_FRAME_SIZE - Rebased on powerpc/merge as of 7 Apr 2020 - Fixed build failure with gcc 9 - Added a patch to create asm/vdso/processor.h and more cpu_relax() in it Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 2 + arch/powerpc/include/asm/vdso/vsyscall.h | 25 ++ arch/powerpc/include/asm/vdso_datapage.h | 40 +-- arch/powerpc/kernel/asm-offsets.c | 49 +--- arch/powerpc/kernel/time.c | 91 +-- arch/powerpc/kernel/vdso.c | 5 +- arch/powerpc/kernel/vdso32/Makefile| 32 ++- arch/powerpc/kernel/vdso32/config-fake32.h | 34 +++ arch/powerpc/kernel/vdso32/gettimeofday.S | 291 + arch/powerpc/kernel/vdso64/Makefile| 23 +- arch/powerpc/kernel/vdso64/gettimeofday.S | 242 + 11 files changed, 143 insertions(+), 691 deletions(-) create mode 100644 arch/powerpc/include/asm/vdso/vsyscall.h create mode 100644 arch/powerpc/kernel/vdso32/config-fake32.h diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index d02b51174fe4..b2d710df9dfe 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -176,6 +176,7 @@ config PPC select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER select GENERIC_TIME_VSYSCALL + select GENERIC_GETTIMEOFDAY select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU select HAVE_ARCH_JUMP_LABEL @@ -206,6 +207,7 @@ config PPC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER select HAVE_GCC_PLUGINS if GCC_VERSION >= 50200 # plugin support on gcc <= 5.1 is buggy on PPC + select HAVE_GENERIC_VDSO select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx) select
[PATCH v12 1/5] powerpc/processor: Move cpu_relax() into asm/vdso/processor.h
cpu_relax() need to be in asm/vdso/processor.h to be used by the C VDSO generic library. Move it there. Signed-off-by: Christophe Leroy --- v9: Forgot to remove cpu_relax() from processor.h in v8 --- arch/powerpc/include/asm/processor.h | 13 ++--- arch/powerpc/include/asm/vdso/processor.h | 23 +++ 2 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 arch/powerpc/include/asm/vdso/processor.h diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 22ffe85a91b8..e8642e1bfb96 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -6,6 +6,8 @@ * Copyright (C) 2001 PPC 64 Team, IBM Corp */ +#include + #include #ifdef CONFIG_VSX @@ -63,14 +65,6 @@ extern int _chrp_type; #endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */ -/* Macros for adjusting thread priority (hardware multi-threading) */ -#define HMT_very_low() asm volatile("or 31,31,31 # very low priority") -#define HMT_low() asm volatile("or 1,1,1 # low priority") -#define HMT_medium_low() asm volatile("or 6,6,6 # medium low priority") -#define HMT_medium()asm volatile("or 2,2,2 # medium priority") -#define HMT_medium_high() asm volatile("or 5,5,5 # medium high priority") -#define HMT_high() asm volatile("or 3,3,3 # high priority") - #ifdef __KERNEL__ #ifdef CONFIG_PPC64 @@ -350,7 +344,6 @@ static inline unsigned long __pack_fe01(unsigned int fpmode) } #ifdef CONFIG_PPC64 -#define cpu_relax()do { HMT_low(); HMT_medium(); barrier(); } while (0) #define spin_begin() HMT_low() @@ -369,8 +362,6 @@ do { \ } \ } while (0) -#else -#define cpu_relax()barrier() #endif /* Check that a certain kernel stack pointer is valid in task_struct p */ diff --git a/arch/powerpc/include/asm/vdso/processor.h b/arch/powerpc/include/asm/vdso/processor.h new file mode 100644 index ..39b9beace9ca --- /dev/null +++ b/arch/powerpc/include/asm/vdso/processor.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ASM_VDSO_PROCESSOR_H +#define __ASM_VDSO_PROCESSOR_H + +#ifndef __ASSEMBLY__ + +/* Macros for adjusting thread priority (hardware multi-threading) */ +#define HMT_very_low() asm volatile("or 31, 31, 31 # very low priority") +#define HMT_low() asm volatile("or 1, 1, 1# low priority") +#define HMT_medium_low() asm volatile("or 6, 6, 6# medium low priority") +#define HMT_medium() asm volatile("or 2, 2, 2# medium priority") +#define HMT_medium_high() asm volatile("or 5, 5, 5# medium high priority") +#define HMT_high() asm volatile("or 3, 3, 3# high priority") + +#ifdef CONFIG_PPC64 +#define cpu_relax()do { HMT_low(); HMT_medium(); barrier(); } while (0) +#else +#define cpu_relax()barrier() +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_VDSO_PROCESSOR_H */ -- 2.25.0
[PATCH v12 2/5] powerpc/vdso: Prepare for switching VDSO to generic C implementation.
Prepare for switching VDSO to generic C implementation in following patch. Here, we: - Prepare the helpers to call the C VDSO functions - Prepare the required callbacks for the C VDSO functions - Prepare the clocksource.h files to define VDSO_ARCH_CLOCKMODES - Add the C trampolines to the generic C VDSO functions powerpc is a bit special for VDSO as well as system calls in the way that it requires setting CR SO bit which cannot be done in C. Therefore, entry/exit needs to be performed in ASM. Implementing __arch_get_vdso_data() would clobber the link register, requiring the caller to save it. As the ASM calling function already has to set a stack frame and saves the link register before calling the C vdso function, retriving the vdso data pointer there is lighter. Implement __arch_vdso_capable() and: - When the timebase is used, make it always return true. - When the RTC clock is used, make it always return false. Provide vdso_shift_ns(), as the generic x >> s gives the following bad result: 18: 35 25 ff e0 addic. r9,r5,-32 1c: 41 80 00 10 blt 2c 20: 7c 64 4c 30 srw r4,r3,r9 24: 38 60 00 00 li r3,0 ... 2c: 54 69 08 3c rlwinm r9,r3,1,0,30 30: 21 45 00 1f subfic r10,r5,31 34: 7c 84 2c 30 srw r4,r4,r5 38: 7d 29 50 30 slw r9,r9,r10 3c: 7c 63 2c 30 srw r3,r3,r5 40: 7d 24 23 78 or r4,r9,r4 In our case the shift is always <= 32. In addition, the upper 32 bits of the result are likely nul. Lets GCC know it, it also optimises the following calculations. With the patch, we get: 0: 21 25 00 20 subfic r9,r5,32 4: 7c 69 48 30 slw r9,r3,r9 8: 7c 84 2c 30 srw r4,r4,r5 c: 7d 24 23 78 or r4,r9,r4 10: 7c 63 2c 30 srw r3,r3,r5 Signed-off-by: Christophe Leroy --- v11: - Changed of __arch_get_hw_counter() to adapt to 4c5a116ada95 ("vdso/treewide: Add vdso_data pointer argument to __arch_get_hw_counter()") v10: - Added a comment to explain the reason for the two stack frames. - Moved back the .cfi_register next to mflr v9: - No more modification of __get_datapage(). Offset is added after. - Adding a second stack frame because the PPC VDSO ABI doesn't force the caller to set one. v8: - New, splitted out of last patch of the series Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/clocksource.h | 7 + arch/powerpc/include/asm/vdso/clocksource.h | 7 + arch/powerpc/include/asm/vdso/gettimeofday.h | 186 +++ arch/powerpc/kernel/vdso32/vgettimeofday.c | 29 +++ arch/powerpc/kernel/vdso64/vgettimeofday.c | 29 +++ 5 files changed, 258 insertions(+) create mode 100644 arch/powerpc/include/asm/clocksource.h create mode 100644 arch/powerpc/include/asm/vdso/clocksource.h create mode 100644 arch/powerpc/include/asm/vdso/gettimeofday.h create mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c create mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c diff --git a/arch/powerpc/include/asm/clocksource.h b/arch/powerpc/include/asm/clocksource.h new file mode 100644 index ..482185566b0c --- /dev/null +++ b/arch/powerpc/include/asm/clocksource.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_CLOCKSOURCE_H +#define _ASM_CLOCKSOURCE_H + +#include + +#endif diff --git a/arch/powerpc/include/asm/vdso/clocksource.h b/arch/powerpc/include/asm/vdso/clocksource.h new file mode 100644 index ..ec5d672d2569 --- /dev/null +++ b/arch/powerpc/include/asm/vdso/clocksource.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_VDSOCLOCKSOURCE_H +#define __ASM_VDSOCLOCKSOURCE_H + +#define VDSO_ARCH_CLOCKMODES VDSO_CLOCKMODE_ARCHTIMER + +#endif diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h new file mode 100644 index ..dce9d5051259 --- /dev/null +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h @@ -0,0 +1,186 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_VDSO_GETTIMEOFDAY_H +#define __ASM_VDSO_GETTIMEOFDAY_H + +#include + +#ifdef __ASSEMBLY__ + +/* + * The macros sets two stack frames, one for the caller and one for the callee + * because there are no requirement for the caller to set a stack frame when + * calling VDSO so it may have omitted to set one, especially on PPC64 + */ + +.macro cvdso_call funct + .cfi_startproc + PPC_STLUr1, -STACK_FRAME_OVERHEAD(r1) + mflrr0 + .cfi_register lr, r0 + PPC_STLUr1, -STACK_FRAME_OVERHEAD(r1) + PPC_STL r0, STACK_FRAME_OVERHEAD + PPC_LR_STKOFF(r1) + get_datapager5, r0 + addir5, r5, VDSO_DATA_OFFSET + bl \funct + PPC_LL r0, STACK_FRAME_OVERHEAD + PPC_LR_STKOFF(r1) + cmpwi r3, 0 + mtlrr0 + .cfi_restore lr + addir1, r1, 2 * STACK_FRAME_OVERHEAD +
[PATCH v12 3/5] powerpc/vdso: Save and restore TOC pointer on PPC64
On PPC64, the TOC pointer needs to be saved and restored. Suggested-by: Michael Ellerman Signed-off-by: Christophe Leroy --- v9: New. I'm not sure this is really needed, I can't see the VDSO C code doing anything with r2, at least on ppc64_defconfig. So I let you decide whether you take it or not. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/vdso/gettimeofday.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h index dce9d5051259..59a609a48b63 100644 --- a/arch/powerpc/include/asm/vdso/gettimeofday.h +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h @@ -19,10 +19,16 @@ .cfi_register lr, r0 PPC_STLUr1, -STACK_FRAME_OVERHEAD(r1) PPC_STL r0, STACK_FRAME_OVERHEAD + PPC_LR_STKOFF(r1) +#ifdef CONFIG_PPC64 + PPC_STL r2, STACK_FRAME_OVERHEAD + STK_GOT(r1) +#endif get_datapager5, r0 addir5, r5, VDSO_DATA_OFFSET bl \funct PPC_LL r0, STACK_FRAME_OVERHEAD + PPC_LR_STKOFF(r1) +#ifdef CONFIG_PPC64 + PPC_LL r2, STACK_FRAME_OVERHEAD + STK_GOT(r1) +#endif cmpwi r3, 0 mtlrr0 .cfi_restore lr @@ -42,10 +48,16 @@ .cfi_register lr, r0 PPC_STLUr1, -STACK_FRAME_OVERHEAD(r1) PPC_STL r0, STACK_FRAME_OVERHEAD + PPC_LR_STKOFF(r1) +#ifdef CONFIG_PPC64 + PPC_STL r2, STACK_FRAME_OVERHEAD + STK_GOT(r1) +#endif get_datapager4, r0 addir4, r4, VDSO_DATA_OFFSET bl \funct PPC_LL r0, STACK_FRAME_OVERHEAD + PPC_LR_STKOFF(r1) +#ifdef CONFIG_PPC64 + PPC_LL r2, STACK_FRAME_OVERHEAD + STK_GOT(r1) +#endif crclr so mtlrr0 .cfi_restore lr -- 2.25.0
[PATCH v3 4/8] powerpc: Remove PowerPC 601
Powerpc 601 is 25 years old. It is not selected by any defconfig. It requires a lot of special handling as it deviates from the standard 6xx. Retire it. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/cputable.c | 15 --- arch/powerpc/platforms/Kconfig.cputype | 11 ++- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 2aa89c6b2896..1f7c3492f2ec 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -608,21 +608,6 @@ static struct cpu_spec __initdata cpu_specs[] = { #endif /* CONFIG_PPC_BOOK3S_64 */ #ifdef CONFIG_PPC32 -#ifdef CONFIG_PPC_BOOK3S_601 - { /* 601 */ - .pvr_mask = 0x, - .pvr_value = 0x0001, - .cpu_name = "601", - .cpu_features = CPU_FTRS_PPC601, - .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR | - PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB, - .mmu_features = MMU_FTR_HPTE_TABLE, - .icache_bsize = 32, - .dcache_bsize = 32, - .machine_check = machine_check_generic, - .platform = "ppc601", - }, -#endif /* CONFIG_PPC_BOOK3S_601 */ #ifdef CONFIG_PPC_BOOK3S_6xx { /* 603 */ .pvr_mask = 0x, diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index e74ec220b5d6..c194c4ae8bc7 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -20,7 +20,7 @@ choice depends on PPC32 help There are five families of 32 bit PowerPC chips supported. - The most common ones are the desktop and server CPUs (601, 603, + The most common ones are the desktop and server CPUs (603, 604, 740, 750, 74xx) CPUs from Freescale and IBM, with their embedded 512x/52xx/82xx/83xx/86xx counterparts. The other embedded parts, namely 4xx, 8xx, e200 (55xx) and e500 @@ -30,7 +30,7 @@ choice If unsure, select 52xx/6xx/7xx/74xx/82xx/83xx/86xx. config PPC_BOOK3S_6xx - bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx except 601" + bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx" select PPC_BOOK3S_32 select PPC_FPU select PPC_HAVE_PMU_SUPPORT @@ -38,13 +38,6 @@ config PPC_BOOK3S_6xx select PPC_HAVE_KUAP select HAVE_ARCH_VMAP_STACK if !ADB_PMU -config PPC_BOOK3S_601 - bool "PowerPC 601" - select PPC_BOOK3S_32 - select PPC_FPU - select PPC_HAVE_KUAP - select HAVE_ARCH_VMAP_STACK - config PPC_85xx bool "Freescale 85xx" select E500 -- 2.25.0
[PATCH v3 8/8] powerpc: Remove get_tb_or_rtc()
601 is gone, get_tb_or_rtc() is equivalent to get_tb(). Replace the former by the later. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/time.h | 5 - arch/powerpc/kernel/irq.c | 2 +- arch/powerpc/kernel/time.c | 6 +++--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index caf68a4bc19e..410ed72eef1c 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h @@ -85,11 +85,6 @@ static inline u64 get_tb(void) } #endif /* !CONFIG_PPC64 */ -static inline u64 get_tb_or_rtc(void) -{ - return get_tb(); -} - static inline void set_tb(unsigned int upper, unsigned int lower) { mtspr(SPRN_TBWL, 0); diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index bf21ebd36190..2d188f81ebdb 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -104,7 +104,7 @@ static inline notrace unsigned long get_irq_happened(void) static inline notrace int decrementer_check_overflow(void) { - u64 now = get_tb_or_rtc(); + u64 now = get_tb(); u64 *next_tb = this_cpu_ptr(_next_tb); return now >= *next_tb; diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 13c820c15d37..760ea359a7f7 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -595,7 +595,7 @@ void timer_interrupt(struct pt_regs *regs) irq_work_run(); } - now = get_tb_or_rtc(); + now = get_tb(); if (now >= *next_tb) { *next_tb = ~(u64)0; if (evt->event_handler) @@ -937,7 +937,7 @@ static void __init clocksource_init(void) static int decrementer_set_next_event(unsigned long evt, struct clock_event_device *dev) { - __this_cpu_write(decrementers_next_tb, get_tb_or_rtc() + evt); + __this_cpu_write(decrementers_next_tb, get_tb() + evt); set_dec(evt); /* We may have raced with new irq work */ @@ -1071,7 +1071,7 @@ void __init time_init(void) tb_to_ns_scale = scale; tb_to_ns_shift = shift; /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */ - boot_tb = get_tb_or_rtc(); + boot_tb = get_tb(); /* If platform provided a timezone (pmac), we correct the time */ if (timezone_offset) { -- 2.25.0
[PATCH v3 7/8] powerpc: Remove __USE_RTC()
Now that PowerPC 601 is gone, __USE_RTC() is never true. Remove it. That also leads to removing get_rtc() and get_rtcl() Signed-off-by: Christophe Leroy --- v2: Also remove get_rtc() and get_rtcl() --- arch/powerpc/include/asm/time.h | 28 +- arch/powerpc/kernel/time.c | 52 + 2 files changed, 9 insertions(+), 71 deletions(-) diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index ce065589192a..caf68a4bc19e 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h @@ -38,9 +38,6 @@ struct div_result { u64 result_low; }; -/* Accessor functions for the timebase (RTC on 601) registers. */ -#define __USE_RTC()(0) - #ifdef CONFIG_PPC64 /* For compatibility, get_tbl() is defined as get_tb() on ppc64 */ @@ -59,25 +56,6 @@ static inline unsigned int get_tbu(void) } #endif /* !CONFIG_PPC64 */ -static inline unsigned int get_rtcl(void) -{ - unsigned int rtcl; - - asm volatile("mfrtcl %0" : "=r" (rtcl)); - return rtcl; -} - -static inline u64 get_rtc(void) -{ - unsigned int hi, lo, hi2; - - do { - asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2" -: "=r" (hi), "=r" (lo), "=r" (hi2)); - } while (hi2 != hi); - return (u64)hi * 10 + lo; -} - static inline u64 get_vtb(void) { #ifdef CONFIG_PPC_BOOK3S_64 @@ -109,7 +87,7 @@ static inline u64 get_tb(void) static inline u64 get_tb_or_rtc(void) { - return __USE_RTC() ? get_rtc() : get_tb(); + return get_tb(); } static inline void set_tb(unsigned int upper, unsigned int lower) @@ -153,10 +131,6 @@ static inline void set_dec(u64 val) static inline unsigned long tb_ticks_since(unsigned long tstamp) { - if (__USE_RTC()) { - int delta = get_rtcl() - (unsigned int) tstamp; - return delta < 0 ? delta + 10 : delta; - } return get_tbl() - tstamp; } diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index f85539ebb513..13c820c15d37 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -75,15 +75,6 @@ #include #include -static u64 rtc_read(struct clocksource *); -static struct clocksource clocksource_rtc = { - .name = "rtc", - .rating = 400, - .flags= CLOCK_SOURCE_IS_CONTINUOUS, - .mask = CLOCKSOURCE_MASK(64), - .read = rtc_read, -}; - static u64 timebase_read(struct clocksource *); static struct clocksource clocksource_timebase = { .name = "timebase", @@ -447,19 +438,9 @@ void vtime_flush(struct task_struct *tsk) void __delay(unsigned long loops) { unsigned long start; - int diff; spin_begin(); - if (__USE_RTC()) { - start = get_rtcl(); - do { - /* the RTCL register wraps at 10 */ - diff = get_rtcl() - start; - if (diff < 0) - diff += 10; - spin_cpu_relax(); - } while (diff < loops); - } else if (tb_invalid) { + if (tb_invalid) { /* * TB is in error state and isn't ticking anymore. * HMI handler was unable to recover from TB error. @@ -696,8 +677,6 @@ EXPORT_SYMBOL_GPL(tb_to_ns); */ notrace unsigned long long sched_clock(void) { - if (__USE_RTC()) - return get_rtc(); return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift; } @@ -847,11 +826,6 @@ void read_persistent_clock64(struct timespec64 *ts) } /* clocksource code */ -static notrace u64 rtc_read(struct clocksource *cs) -{ - return (u64)get_rtc(); -} - static notrace u64 timebase_read(struct clocksource *cs) { return (u64)get_tb(); @@ -948,12 +922,7 @@ void update_vsyscall_tz(void) static void __init clocksource_init(void) { - struct clocksource *clock; - - if (__USE_RTC()) - clock = _rtc; - else - clock = _timebase; + struct clocksource *clock = _timebase; if (clocksource_register_hz(clock, tb_ticks_per_sec)) { printk(KERN_ERR "clocksource: %s is already registered\n", @@ -1071,17 +1040,12 @@ void __init time_init(void) u64 scale; unsigned shift; - if (__USE_RTC()) { - /* 601 processor: dec counts down by 128 every 128ns */ - ppc_tb_freq = 10; - } else { - /* Normal PowerPC with timebase register */ - ppc_md.calibrate_decr(); - printk(KERN_DEBUG "time_init: decrementer frequency = %lu.%.6lu MHz\n", - ppc_tb_freq / 100, ppc_tb_freq % 100); - printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n", -
[PATCH v3 6/8] powerpc: Tidy up a bit after removal of PowerPC 601.
The removal of the 601 left some standalone blocks from former if/else. Drop the { } and re-indent. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/btext.c| 11 +++-- arch/powerpc/mm/book3s32/mmu.c | 45 +++--- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index b609fb39dba8..c22a8e0dbc93 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -95,13 +95,10 @@ void __init btext_prepare_BAT(void) boot_text_mapped = 0; return; } - { - /* 603, 604, G3, G4, ... */ - lowbits = addr & ~0xFF00UL; - addr &= 0xFF00UL; - disp_BAT[0] = vaddr | (BL_16M<<2) | 2; - disp_BAT[1] = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); - } + lowbits = addr & ~0xFF00UL; + addr &= 0xFF00UL; + disp_BAT[0] = vaddr | (BL_16M<<2) | 2; + disp_BAT[1] = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); logicalDisplayBase = (void *) (vaddr + lowbits); } #endif diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index 771d607f1a3d..741e4fc990c7 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -73,16 +73,13 @@ unsigned long p_block_mapped(phys_addr_t pa) static int find_free_bat(void) { int b; + int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; - { - int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; + for (b = 0; b < n; b++) { + struct ppc_bat *bat = BATS[b]; - for (b = 0; b < n; b++) { - struct ppc_bat *bat = BATS[b]; - - if (!(bat[1].batu & 3)) - return b; - } + if (!(bat[1].batu & 3)) + return b; } return -1; } @@ -280,24 +277,22 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys, flags &= ~_PAGE_COHERENT; bl = (size >> 17) - 1; - { - /* Do DBAT first */ - wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE - | _PAGE_COHERENT | _PAGE_GUARDED); - wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; - bat[1].batu = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ - bat[1].batl = BAT_PHYS_ADDR(phys) | wimgxpp; - if (flags & _PAGE_USER) - bat[1].batu |= 1; /* Vp = 1 */ - if (flags & _PAGE_GUARDED) { - /* G bit must be zero in IBATs */ - flags &= ~_PAGE_EXEC; - } - if (flags & _PAGE_EXEC) - bat[0] = bat[1]; - else - bat[0].batu = bat[0].batl = 0; + /* Do DBAT first */ + wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE + | _PAGE_COHERENT | _PAGE_GUARDED); + wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; + bat[1].batu = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ + bat[1].batl = BAT_PHYS_ADDR(phys) | wimgxpp; + if (flags & _PAGE_USER) + bat[1].batu |= 1; /* Vp = 1 */ + if (flags & _PAGE_GUARDED) { + /* G bit must be zero in IBATs */ + flags &= ~_PAGE_EXEC; } + if (flags & _PAGE_EXEC) + bat[0] = bat[1]; + else + bat[0].batu = bat[0].batl = 0; bat_addrs[index].start = virt; bat_addrs[index].limit = virt + ((bl + 1) << 17) - 1; -- 2.25.0
[PATCH v3 5/8] powerpc: Remove support for PowerPC 601
PowerPC 601 has been retired. Remove all associated specific code. CPU_FTRS_PPC601 has CPU_FTR_COHERENT_ICACHE and CPU_FTR_COMMON. CPU_FTR_COMMON is already present via other CPU_FTRS. None of the remaining CPU selects CPU_FTR_COHERENT_ICACHE. So CPU_FTRS_PPC601 can be removed from the possible features, hence can be removed completely. Signed-off-by: Christophe Leroy --- arch/powerpc/boot/util.S| 15 +-- arch/powerpc/include/asm/cputable.h | 12 ++--- arch/powerpc/include/asm/ppc_asm.h | 3 +- arch/powerpc/include/asm/ptrace.h | 4 -- arch/powerpc/include/asm/time.h | 2 +- arch/powerpc/include/asm/timex.h| 3 -- arch/powerpc/kernel/btext.c | 8 +--- arch/powerpc/kernel/entry_32.S | 18 arch/powerpc/kernel/head_32.S | 44 ++ arch/powerpc/kernel/setup_32.c | 2 +- arch/powerpc/kernel/traps.c | 4 -- arch/powerpc/kernel/vdso32/datapage.S | 2 - arch/powerpc/kernel/vdso32/vdso32.lds.S | 2 - arch/powerpc/mm/book3s32/mmu.c | 39 +++- arch/powerpc/mm/ptdump/bats.c | 59 - arch/powerpc/platforms/powermac/setup.c | 2 +- arch/powerpc/platforms/powermac/smp.c | 4 -- 17 files changed, 17 insertions(+), 206 deletions(-) diff --git a/arch/powerpc/boot/util.S b/arch/powerpc/boot/util.S index f11f0589a669..d03cdb7606dc 100644 --- a/arch/powerpc/boot/util.S +++ b/arch/powerpc/boot/util.S @@ -18,7 +18,7 @@ .text -/* udelay (on non-601 processors) needs to know the period of the +/* udelay needs to know the period of the * timebase in nanoseconds. This used to be hardcoded to be 60ns * (period of 66MHz/4). Now a variable is used that is initialized to * 60 for backward compatibility, but it can be overridden as necessary @@ -37,19 +37,6 @@ timebase_period_ns: */ .globl udelay udelay: - mfspr r4,SPRN_PVR - srwir4,r4,16 - cmpwi 0,r4,1 /* 601 ? */ - bne .Ludelay_not_601 -00:li r0,86 /* Instructions / microsecond? */ - mtctr r0 -10:addir0,r0,0 /* NOP */ - bdnz10b - subic. r3,r3,1 - bne 00b - blr - -.Ludelay_not_601: mulli r4,r3,1000 /* nanoseconds */ /* Change r4 to be the number of ticks using: * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 8ca5885bd5b9..0d10ac3328ca 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -300,8 +300,6 @@ static inline void cpu_feature_keys_init(void) { } #define CPU_FTR_MAYBE_CAN_NAP 0 #endif -#define CPU_FTRS_PPC601(CPU_FTR_COMMON | \ - CPU_FTR_COHERENT_ICACHE) #define CPU_FTRS_603 (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE | CPU_FTR_NOEXECUTE) #define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_PPC_LE) @@ -517,10 +515,8 @@ static inline void cpu_feature_keys_init(void) { } #else enum { CPU_FTRS_POSSIBLE = -#ifdef CONFIG_PPC_BOOK3S_601 - CPU_FTRS_PPC601 | -#elif defined(CONFIG_PPC_BOOK3S_32) - CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | +#ifdef CONFIG_PPC_BOOK3S_32 + CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | CPU_FTRS_750FX2 | CPU_FTRS_750FX | CPU_FTRS_750GX | CPU_FTRS_7400_NOTAU | CPU_FTRS_7400 | CPU_FTRS_7450_20 | @@ -595,9 +591,7 @@ enum { #else enum { CPU_FTRS_ALWAYS = -#ifdef CONFIG_PPC_BOOK3S_601 - CPU_FTRS_PPC601 & -#elif defined(CONFIG_PPC_BOOK3S_32) +#ifdef CONFIG_PPC_BOOK3S_32 CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & CPU_FTRS_750FX2 & CPU_FTRS_750FX & CPU_FTRS_750GX & diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 67a421b81a50..511786f0e40d 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -401,8 +401,7 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96) #define MFTBU(dest)mfspr dest, SPRN_TBRU #endif -/* tlbsync is not implemented on 601 */ -#if !defined(CONFIG_SMP) || defined(CONFIG_PPC_BOOK3S_601) +#ifndef CONFIG_SMP #define TLBSYNC #else #define TLBSYNCtlbsync; sync diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index 155a197c0aa1..e2c778c176a3 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -243,11 +243,7 @@ static inline void set_trap_norestart(struct pt_regs *regs) } #define arch_has_single_step() (1) -#ifndef CONFIG_PPC_BOOK3S_601 #define arch_has_block_step() (true) -#else
[PATCH v3 3/8] powerpc: Drop SYNC_601() ISYNC_601() and SYNC()
Those macros are now empty at all time. Drop them. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc_asm.h | 4 arch/powerpc/kernel/entry_32.S | 17 + arch/powerpc/kernel/fpu.S | 1 - arch/powerpc/kernel/head_32.S | 9 - arch/powerpc/kernel/head_32.h | 1 - arch/powerpc/kernel/l2cr_6xx.S | 3 +-- arch/powerpc/mm/book3s32/hash_low.S | 12 7 files changed, 2 insertions(+), 45 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 0b9dc814b81c..67a421b81a50 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -382,10 +382,6 @@ GLUE(.,name): #endif /* various errata or part fixups */ -#defineSYNC -#define SYNC_601 -#define ISYNC_601 - #if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E) #define MFTB(dest) \ 90:mfspr dest, SPRN_TBRL; \ diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index f4d0af8e1136..f25ea188ecd3 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -234,7 +234,6 @@ transfer_to_handler_cont: mtspr SPRN_SRR0,r11 mtspr SPRN_SRR1,r10 mtlrr9 - SYNC RFI /* jump to handler, enable MMU */ #if defined (CONFIG_PPC_BOOK3S_32) || defined(CONFIG_E500) @@ -264,7 +263,6 @@ _ASM_NOKPROBE_SYMBOL(transfer_to_handler_cont) LOAD_REG_IMMEDIATE(r0, MSR_KERNEL) mtspr SPRN_SRR0,r12 mtspr SPRN_SRR1,r0 - SYNC RFI reenable_mmu: @@ -323,7 +321,6 @@ stack_ovf: #endif mtspr SPRN_SRR0,r9 mtspr SPRN_SRR1,r10 - SYNC RFI _ASM_NOKPROBE_SYMBOL(stack_ovf) #endif @@ -411,7 +408,6 @@ ret_from_syscall: /* disable interrupts so current_thread_info()->flags can't change */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL) /* doesn't include MSR_EE */ /* Note: We don't bother telling lockdep about it */ - SYNC mtmsr r10 lwz r9,TI_FLAGS(r2) li r8,-MAX_ERRNO @@ -474,7 +470,6 @@ syscall_exit_finish: #endif mtspr SPRN_SRR0,r7 mtspr SPRN_SRR1,r8 - SYNC RFI _ASM_NOKPROBE_SYMBOL(syscall_exit_finish) #ifdef CONFIG_44x @@ -567,7 +562,6 @@ syscall_exit_work: * lockdep as we are supposed to have IRQs on at this point */ ori r10,r10,MSR_EE - SYNC mtmsr r10 /* Save NVGPRS if they're not saved already */ @@ -606,7 +600,6 @@ ret_from_kernel_syscall: #endif mtspr SPRN_SRR0, r9 mtspr SPRN_SRR1, r10 - SYNC RFI _ASM_NOKPROBE_SYMBOL(ret_from_kernel_syscall) @@ -810,7 +803,6 @@ fast_exception_return: REST_GPR(9, r11) REST_GPR(12, r11) lwz r11,GPR11(r11) - SYNC RFI _ASM_NOKPROBE_SYMBOL(fast_exception_return) @@ -872,7 +864,6 @@ ret_from_except: * from the interrupt. */ /* Note: We don't bother telling lockdep about it */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL) - SYNC/* Some chip revs have problems here... */ mtmsr r10 /* disable interrupts */ lwz r3,_MSR(r1) /* Returning to user mode? */ @@ -1035,7 +1026,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) * exc_exit_restart below. -- paulus */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL & ~MSR_RI) - SYNC mtmsr r10 /* clear the RI bit */ .globl exc_exit_restart exc_exit_restart: @@ -1046,7 +1036,6 @@ exc_exit_restart: lwz r1,GPR1(r1) .globl exc_exit_restart_end exc_exit_restart_end: - SYNC RFI _ASM_NOKPROBE_SYMBOL(exc_exit_restart) _ASM_NOKPROBE_SYMBOL(exc_exit_restart_end) @@ -1274,7 +1263,6 @@ do_resched: /* r10 contains MSR_KERNEL here */ mfmsr r10 #endif ori r10,r10,MSR_EE - SYNC mtmsr r10 /* hard-enable interrupts */ bl schedule recheck: @@ -1283,7 +1271,6 @@ recheck: * TI_FLAGS aren't advertised. */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL) - SYNC mtmsr r10 /* disable interrupts */ lwz r9,TI_FLAGS(r2) andi. r0,r9,_TIF_NEED_RESCHED @@ -1292,7 +1279,6 @@ recheck: beq restore_user do_user_signal:/* r10 contains MSR_KERNEL here */ ori r10,r10,MSR_EE - SYNC mtmsr r10 /* hard-enable interrupts */ /* save r13-r31 in the exception frame, if not already done */ lwz r3,_TRAP(r1) @@ -1382,8 +1368,7 @@ _GLOBAL(enter_rtas) mfmsr r9 stw r9,8(r1) LOAD_REG_IMMEDIATE(r0,MSR_KERNEL) - SYNC/* disable interrupts so SRR0/1 */ - mtmsr r0
[PATCH v3 2/8] powerpc: Remove CONFIG_PPC601_SYNC_FIX
This config option isn't in any defconfig. The very first versions of Powerpc 601 have a bug which requires additional sync before and/or after some instructions. This was more than 25 years ago and time has come to retire those buggy versions of the 601 from the kernel. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc_asm.h | 6 -- arch/powerpc/platforms/Kconfig | 15 --- 2 files changed, 21 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index b4cc6608131c..0b9dc814b81c 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -382,15 +382,9 @@ GLUE(.,name): #endif /* various errata or part fixups */ -#ifdef CONFIG_PPC601_SYNC_FIX -#define SYNC sync; isync -#define SYNC_601 sync -#define ISYNC_601 isync -#else #defineSYNC #define SYNC_601 #define ISYNC_601 -#endif #if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E) #define MFTB(dest) \ diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index b439b027a42f..7a5e8f4541e3 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -199,21 +199,6 @@ source "drivers/cpuidle/Kconfig" endmenu -config PPC601_SYNC_FIX - bool "Workarounds for PPC601 bugs" - depends on PPC_BOOK3S_601 && PPC_PMAC - default y - help - Some versions of the PPC601 (the first PowerPC chip) have bugs which - mean that extra synchronization instructions are required near - certain instructions, typically those that make major changes to the - CPU state. These extra instructions reduce performance slightly. - If you say N here, these extra instructions will not be included, - resulting in a kernel which will run faster but may not run at all - on some systems with the PPC601 chip. - - If in doubt, say Y here. - config TAU bool "On-chip CPU temperature sensor support" depends on PPC_BOOK3S_32 -- 2.25.0
[PATCH v3 1/8] powerpc: Remove SYNC on non 6xx
SYNC is usefull for Powerpc 601 only. On everything else, SYNC is empty. Remove it from code that is not made to run on 6xx. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_40x.S | 1 - arch/powerpc/kernel/head_booke.h | 1 - arch/powerpc/kernel/misc_64.S| 1 - 3 files changed, 3 deletions(-) diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S index 5b282d9965a5..44c9018aed1b 100644 --- a/arch/powerpc/kernel/head_40x.S +++ b/arch/powerpc/kernel/head_40x.S @@ -72,7 +72,6 @@ turn_on_mmu: lis r0,start_here@h ori r0,r0,start_here@l mtspr SPRN_SRR0,r0 - SYNC rfi /* enables MMU */ b . /* prevent prefetch past rfi */ diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index 18f87bf9e32b..71c359d438b5 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h @@ -176,7 +176,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) #endif mtspr SPRN_SRR1,r10 mtspr SPRN_SRR0,r11 - SYNC RFI /* jump to handler, enable MMU */ 99:b ret_from_kernel_syscall .endm diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index 7bb46ad98207..070465825c21 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -365,7 +365,6 @@ _GLOBAL(kexec_smp_wait) li r4,KEXEC_STATE_REAL_MODE stb r4,PACAKEXECSTATE(r13) - SYNC b kexec_wait -- 2.25.0
Re: [PATCH v2 1/7] powerpc: Remove SYNC on non 6xx
Le 29/09/2020 à 08:09, Christophe Leroy a écrit : SYNC is usefull for Powerpc 601 only. On everything else, SYNC is empty. Remove it from code that is not made to run on 6xx. Signed-off-by: Christophe Leroy Oops, the last patch of the series is missing. Will resend, sorry for the noise. Christophe --- arch/powerpc/kernel/head_40x.S | 1 - arch/powerpc/kernel/head_booke.h | 1 - arch/powerpc/kernel/misc_64.S| 1 - 3 files changed, 3 deletions(-) diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S index 5b282d9965a5..44c9018aed1b 100644 --- a/arch/powerpc/kernel/head_40x.S +++ b/arch/powerpc/kernel/head_40x.S @@ -72,7 +72,6 @@ turn_on_mmu: lis r0,start_here@h ori r0,r0,start_here@l mtspr SPRN_SRR0,r0 - SYNC rfi /* enables MMU */ b . /* prevent prefetch past rfi */ diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index 18f87bf9e32b..71c359d438b5 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h @@ -176,7 +176,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) #endif mtspr SPRN_SRR1,r10 mtspr SPRN_SRR0,r11 - SYNC RFI /* jump to handler, enable MMU */ 99: b ret_from_kernel_syscall .endm diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index 7bb46ad98207..070465825c21 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -365,7 +365,6 @@ _GLOBAL(kexec_smp_wait) li r4,KEXEC_STATE_REAL_MODE stb r4,PACAKEXECSTATE(r13) - SYNC b kexec_wait
Re: [PATCH] linux: configure CONFIG_I2C_OPAL as in-built.
On Fri, 25 Sep 2020 at 18:19, Mimi Zohar wrote: > > Hi Nayna, > > On Wed, 2020-09-23 at 14:25 -0400, Nayna Jain wrote: > > Currently, skiroot_defconfig CONFIG_I2C_OPAL is built as a loadable > > module rather than builtin, even if CONFIG_I2C=y is defined. This > > results in a delay in the TPM initialization, causing IMA to go into > > TPM bypass mode. As a result, the IMA measurements are added to the > > measurement list, but do not extend the TPM. Because of this, it is > > impossible to verify or attest to the system's integrity, either from > > skiroot or the target Host OS. > > The patch description is good, but perhaps we could provide a bit more > context before. > > The concept of trusted boot requires the measurement to be added to the > measurement list and extend the TPM, prior to allowing access to the > file. By allowing access to a file before its measurement is included > in the measurement list and extended into the TPM PCR, a malicious file > could potentially prevent its own measurement from being added. As the > PCRs are tamper proof, measuring and extending the TPM prior to giving > access to the file, guarantees that all file measurements are included > in the measurement list, including the malicious file. > > IMA needs to be enabled before any files are accessed in order to > verify a file's integrity and extend the TPM with the file > measurement. Queueing file measurements breaks the measure and extend, > before usage, trusted boot paradigm. > > The ima-evm-utils package includes a test for walking the IMA > measurement list, calculating the expected TPM PCRs, and comparing the > calculated PCR values with the physical TPM. Testing is important to > ensure the TPM is initialized prior to IMA. Failure to validate the > IMA measurement list may indicate IMA went into TPM bypass mode, like > in this case. Thanks for the explanation Mimi. It's lucky that the TPM drivers can be loaded early enough! Should we add something like this to security/integrity/ima/Kconfig? select I2C_OPAL if PPC_POWERNV It's generally frowned upon to select user visible symbols, but IMA does this for the TCG options already. Cheers, Joel > > thanks, > > Mimi > > > > > Reported-by: Mimi Zohar > > Signed-off-by: Nayna Jain > > --- > > openpower/configs/linux/skiroot_defconfig | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/openpower/configs/linux/skiroot_defconfig > > b/openpower/configs/linux/skiroot_defconfig > > index 44309e12..a555adb2 100644 > > --- a/openpower/configs/linux/skiroot_defconfig > > +++ b/openpower/configs/linux/skiroot_defconfig > > @@ -216,7 +216,7 @@ CONFIG_I2C=y > > CONFIG_I2C_CHARDEV=y > > # CONFIG_I2C_HELPER_AUTO is not set > > CONFIG_I2C_ALGOBIT=y > > -CONFIG_I2C_OPAL=m > > +CONFIG_I2C_OPAL=y > > CONFIG_PPS=y > > CONFIG_SENSORS_IBMPOWERNV=m > > CONFIG_DRM=m > >
[PATCH v2 6/7] powerpc: Tidy up a bit after removal of PowerPC 601.
The removal of the 601 left some standalone blocks from former if/else. Drop the { } and re-indent. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/btext.c| 11 +++-- arch/powerpc/mm/book3s32/mmu.c | 45 +++--- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index b609fb39dba8..c22a8e0dbc93 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -95,13 +95,10 @@ void __init btext_prepare_BAT(void) boot_text_mapped = 0; return; } - { - /* 603, 604, G3, G4, ... */ - lowbits = addr & ~0xFF00UL; - addr &= 0xFF00UL; - disp_BAT[0] = vaddr | (BL_16M<<2) | 2; - disp_BAT[1] = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); - } + lowbits = addr & ~0xFF00UL; + addr &= 0xFF00UL; + disp_BAT[0] = vaddr | (BL_16M<<2) | 2; + disp_BAT[1] = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); logicalDisplayBase = (void *) (vaddr + lowbits); } #endif diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index 771d607f1a3d..741e4fc990c7 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -73,16 +73,13 @@ unsigned long p_block_mapped(phys_addr_t pa) static int find_free_bat(void) { int b; + int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; - { - int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; + for (b = 0; b < n; b++) { + struct ppc_bat *bat = BATS[b]; - for (b = 0; b < n; b++) { - struct ppc_bat *bat = BATS[b]; - - if (!(bat[1].batu & 3)) - return b; - } + if (!(bat[1].batu & 3)) + return b; } return -1; } @@ -280,24 +277,22 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys, flags &= ~_PAGE_COHERENT; bl = (size >> 17) - 1; - { - /* Do DBAT first */ - wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE - | _PAGE_COHERENT | _PAGE_GUARDED); - wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; - bat[1].batu = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ - bat[1].batl = BAT_PHYS_ADDR(phys) | wimgxpp; - if (flags & _PAGE_USER) - bat[1].batu |= 1; /* Vp = 1 */ - if (flags & _PAGE_GUARDED) { - /* G bit must be zero in IBATs */ - flags &= ~_PAGE_EXEC; - } - if (flags & _PAGE_EXEC) - bat[0] = bat[1]; - else - bat[0].batu = bat[0].batl = 0; + /* Do DBAT first */ + wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE + | _PAGE_COHERENT | _PAGE_GUARDED); + wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; + bat[1].batu = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ + bat[1].batl = BAT_PHYS_ADDR(phys) | wimgxpp; + if (flags & _PAGE_USER) + bat[1].batu |= 1; /* Vp = 1 */ + if (flags & _PAGE_GUARDED) { + /* G bit must be zero in IBATs */ + flags &= ~_PAGE_EXEC; } + if (flags & _PAGE_EXEC) + bat[0] = bat[1]; + else + bat[0].batu = bat[0].batl = 0; bat_addrs[index].start = virt; bat_addrs[index].limit = virt + ((bl + 1) << 17) - 1; -- 2.25.0
[PATCH v2 7/7] powerpc: Remove __USE_RTC()
Now that PowerPC 601 is gone, __USE_RTC() is never true. Remove it. That also leads to removing get_rtc() and get_rtcl() Signed-off-by: Christophe Leroy --- v2: Also remove get_rtc() and get_rtcl() --- arch/powerpc/include/asm/time.h | 28 +- arch/powerpc/kernel/time.c | 52 + 2 files changed, 9 insertions(+), 71 deletions(-) diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index ce065589192a..caf68a4bc19e 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h @@ -38,9 +38,6 @@ struct div_result { u64 result_low; }; -/* Accessor functions for the timebase (RTC on 601) registers. */ -#define __USE_RTC()(0) - #ifdef CONFIG_PPC64 /* For compatibility, get_tbl() is defined as get_tb() on ppc64 */ @@ -59,25 +56,6 @@ static inline unsigned int get_tbu(void) } #endif /* !CONFIG_PPC64 */ -static inline unsigned int get_rtcl(void) -{ - unsigned int rtcl; - - asm volatile("mfrtcl %0" : "=r" (rtcl)); - return rtcl; -} - -static inline u64 get_rtc(void) -{ - unsigned int hi, lo, hi2; - - do { - asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2" -: "=r" (hi), "=r" (lo), "=r" (hi2)); - } while (hi2 != hi); - return (u64)hi * 10 + lo; -} - static inline u64 get_vtb(void) { #ifdef CONFIG_PPC_BOOK3S_64 @@ -109,7 +87,7 @@ static inline u64 get_tb(void) static inline u64 get_tb_or_rtc(void) { - return __USE_RTC() ? get_rtc() : get_tb(); + return get_tb(); } static inline void set_tb(unsigned int upper, unsigned int lower) @@ -153,10 +131,6 @@ static inline void set_dec(u64 val) static inline unsigned long tb_ticks_since(unsigned long tstamp) { - if (__USE_RTC()) { - int delta = get_rtcl() - (unsigned int) tstamp; - return delta < 0 ? delta + 10 : delta; - } return get_tbl() - tstamp; } diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index f85539ebb513..13c820c15d37 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -75,15 +75,6 @@ #include #include -static u64 rtc_read(struct clocksource *); -static struct clocksource clocksource_rtc = { - .name = "rtc", - .rating = 400, - .flags= CLOCK_SOURCE_IS_CONTINUOUS, - .mask = CLOCKSOURCE_MASK(64), - .read = rtc_read, -}; - static u64 timebase_read(struct clocksource *); static struct clocksource clocksource_timebase = { .name = "timebase", @@ -447,19 +438,9 @@ void vtime_flush(struct task_struct *tsk) void __delay(unsigned long loops) { unsigned long start; - int diff; spin_begin(); - if (__USE_RTC()) { - start = get_rtcl(); - do { - /* the RTCL register wraps at 10 */ - diff = get_rtcl() - start; - if (diff < 0) - diff += 10; - spin_cpu_relax(); - } while (diff < loops); - } else if (tb_invalid) { + if (tb_invalid) { /* * TB is in error state and isn't ticking anymore. * HMI handler was unable to recover from TB error. @@ -696,8 +677,6 @@ EXPORT_SYMBOL_GPL(tb_to_ns); */ notrace unsigned long long sched_clock(void) { - if (__USE_RTC()) - return get_rtc(); return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift; } @@ -847,11 +826,6 @@ void read_persistent_clock64(struct timespec64 *ts) } /* clocksource code */ -static notrace u64 rtc_read(struct clocksource *cs) -{ - return (u64)get_rtc(); -} - static notrace u64 timebase_read(struct clocksource *cs) { return (u64)get_tb(); @@ -948,12 +922,7 @@ void update_vsyscall_tz(void) static void __init clocksource_init(void) { - struct clocksource *clock; - - if (__USE_RTC()) - clock = _rtc; - else - clock = _timebase; + struct clocksource *clock = _timebase; if (clocksource_register_hz(clock, tb_ticks_per_sec)) { printk(KERN_ERR "clocksource: %s is already registered\n", @@ -1071,17 +1040,12 @@ void __init time_init(void) u64 scale; unsigned shift; - if (__USE_RTC()) { - /* 601 processor: dec counts down by 128 every 128ns */ - ppc_tb_freq = 10; - } else { - /* Normal PowerPC with timebase register */ - ppc_md.calibrate_decr(); - printk(KERN_DEBUG "time_init: decrementer frequency = %lu.%.6lu MHz\n", - ppc_tb_freq / 100, ppc_tb_freq % 100); - printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n", -
[PATCH v2 2/7] powerpc: Remove CONFIG_PPC601_SYNC_FIX
This config option isn't in any defconfig. The very first versions of Powerpc 601 have a bug which requires additional sync before and/or after some instructions. This was more than 25 years ago and time has come to retire those buggy versions of the 601 from the kernel. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc_asm.h | 6 -- arch/powerpc/platforms/Kconfig | 15 --- 2 files changed, 21 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index b4cc6608131c..0b9dc814b81c 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -382,15 +382,9 @@ GLUE(.,name): #endif /* various errata or part fixups */ -#ifdef CONFIG_PPC601_SYNC_FIX -#define SYNC sync; isync -#define SYNC_601 sync -#define ISYNC_601 isync -#else #defineSYNC #define SYNC_601 #define ISYNC_601 -#endif #if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E) #define MFTB(dest) \ diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index b439b027a42f..7a5e8f4541e3 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -199,21 +199,6 @@ source "drivers/cpuidle/Kconfig" endmenu -config PPC601_SYNC_FIX - bool "Workarounds for PPC601 bugs" - depends on PPC_BOOK3S_601 && PPC_PMAC - default y - help - Some versions of the PPC601 (the first PowerPC chip) have bugs which - mean that extra synchronization instructions are required near - certain instructions, typically those that make major changes to the - CPU state. These extra instructions reduce performance slightly. - If you say N here, these extra instructions will not be included, - resulting in a kernel which will run faster but may not run at all - on some systems with the PPC601 chip. - - If in doubt, say Y here. - config TAU bool "On-chip CPU temperature sensor support" depends on PPC_BOOK3S_32 -- 2.25.0
[PATCH v2 5/7] powerpc: Remove support for PowerPC 601
PowerPC 601 has been retired. Remove all associated specific code. CPU_FTRS_PPC601 has CPU_FTR_COHERENT_ICACHE and CPU_FTR_COMMON. CPU_FTR_COMMON is already present via other CPU_FTRS. None of the remaining CPU selects CPU_FTR_COHERENT_ICACHE. So CPU_FTRS_PPC601 can be removed from the possible features, hence can be removed completely. Signed-off-by: Christophe Leroy --- arch/powerpc/boot/util.S| 15 +-- arch/powerpc/include/asm/cputable.h | 12 ++--- arch/powerpc/include/asm/ppc_asm.h | 3 +- arch/powerpc/include/asm/ptrace.h | 4 -- arch/powerpc/include/asm/time.h | 2 +- arch/powerpc/include/asm/timex.h| 3 -- arch/powerpc/kernel/btext.c | 8 +--- arch/powerpc/kernel/entry_32.S | 18 arch/powerpc/kernel/head_32.S | 44 ++ arch/powerpc/kernel/setup_32.c | 2 +- arch/powerpc/kernel/traps.c | 4 -- arch/powerpc/kernel/vdso32/datapage.S | 2 - arch/powerpc/kernel/vdso32/vdso32.lds.S | 2 - arch/powerpc/mm/book3s32/mmu.c | 39 +++- arch/powerpc/mm/ptdump/bats.c | 59 - arch/powerpc/platforms/powermac/setup.c | 2 +- arch/powerpc/platforms/powermac/smp.c | 4 -- 17 files changed, 17 insertions(+), 206 deletions(-) diff --git a/arch/powerpc/boot/util.S b/arch/powerpc/boot/util.S index f11f0589a669..d03cdb7606dc 100644 --- a/arch/powerpc/boot/util.S +++ b/arch/powerpc/boot/util.S @@ -18,7 +18,7 @@ .text -/* udelay (on non-601 processors) needs to know the period of the +/* udelay needs to know the period of the * timebase in nanoseconds. This used to be hardcoded to be 60ns * (period of 66MHz/4). Now a variable is used that is initialized to * 60 for backward compatibility, but it can be overridden as necessary @@ -37,19 +37,6 @@ timebase_period_ns: */ .globl udelay udelay: - mfspr r4,SPRN_PVR - srwir4,r4,16 - cmpwi 0,r4,1 /* 601 ? */ - bne .Ludelay_not_601 -00:li r0,86 /* Instructions / microsecond? */ - mtctr r0 -10:addir0,r0,0 /* NOP */ - bdnz10b - subic. r3,r3,1 - bne 00b - blr - -.Ludelay_not_601: mulli r4,r3,1000 /* nanoseconds */ /* Change r4 to be the number of ticks using: * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 8ca5885bd5b9..0d10ac3328ca 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -300,8 +300,6 @@ static inline void cpu_feature_keys_init(void) { } #define CPU_FTR_MAYBE_CAN_NAP 0 #endif -#define CPU_FTRS_PPC601(CPU_FTR_COMMON | \ - CPU_FTR_COHERENT_ICACHE) #define CPU_FTRS_603 (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE | CPU_FTR_NOEXECUTE) #define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_PPC_LE) @@ -517,10 +515,8 @@ static inline void cpu_feature_keys_init(void) { } #else enum { CPU_FTRS_POSSIBLE = -#ifdef CONFIG_PPC_BOOK3S_601 - CPU_FTRS_PPC601 | -#elif defined(CONFIG_PPC_BOOK3S_32) - CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | +#ifdef CONFIG_PPC_BOOK3S_32 + CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | CPU_FTRS_750FX2 | CPU_FTRS_750FX | CPU_FTRS_750GX | CPU_FTRS_7400_NOTAU | CPU_FTRS_7400 | CPU_FTRS_7450_20 | @@ -595,9 +591,7 @@ enum { #else enum { CPU_FTRS_ALWAYS = -#ifdef CONFIG_PPC_BOOK3S_601 - CPU_FTRS_PPC601 & -#elif defined(CONFIG_PPC_BOOK3S_32) +#ifdef CONFIG_PPC_BOOK3S_32 CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & CPU_FTRS_750FX2 & CPU_FTRS_750FX & CPU_FTRS_750GX & diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 67a421b81a50..511786f0e40d 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -401,8 +401,7 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96) #define MFTBU(dest)mfspr dest, SPRN_TBRU #endif -/* tlbsync is not implemented on 601 */ -#if !defined(CONFIG_SMP) || defined(CONFIG_PPC_BOOK3S_601) +#ifndef CONFIG_SMP #define TLBSYNC #else #define TLBSYNCtlbsync; sync diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index 155a197c0aa1..e2c778c176a3 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -243,11 +243,7 @@ static inline void set_trap_norestart(struct pt_regs *regs) } #define arch_has_single_step() (1) -#ifndef CONFIG_PPC_BOOK3S_601 #define arch_has_block_step() (true) -#else
[PATCH v2 4/7] powerpc: Remove PowerPC 601
Powerpc 601 is 25 years old. It is not selected by any defconfig. It requires a lot of special handling as it deviates from the standard 6xx. Retire it. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/cputable.c | 15 --- arch/powerpc/platforms/Kconfig.cputype | 11 ++- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 2aa89c6b2896..1f7c3492f2ec 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -608,21 +608,6 @@ static struct cpu_spec __initdata cpu_specs[] = { #endif /* CONFIG_PPC_BOOK3S_64 */ #ifdef CONFIG_PPC32 -#ifdef CONFIG_PPC_BOOK3S_601 - { /* 601 */ - .pvr_mask = 0x, - .pvr_value = 0x0001, - .cpu_name = "601", - .cpu_features = CPU_FTRS_PPC601, - .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR | - PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB, - .mmu_features = MMU_FTR_HPTE_TABLE, - .icache_bsize = 32, - .dcache_bsize = 32, - .machine_check = machine_check_generic, - .platform = "ppc601", - }, -#endif /* CONFIG_PPC_BOOK3S_601 */ #ifdef CONFIG_PPC_BOOK3S_6xx { /* 603 */ .pvr_mask = 0x, diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index e74ec220b5d6..c194c4ae8bc7 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -20,7 +20,7 @@ choice depends on PPC32 help There are five families of 32 bit PowerPC chips supported. - The most common ones are the desktop and server CPUs (601, 603, + The most common ones are the desktop and server CPUs (603, 604, 740, 750, 74xx) CPUs from Freescale and IBM, with their embedded 512x/52xx/82xx/83xx/86xx counterparts. The other embedded parts, namely 4xx, 8xx, e200 (55xx) and e500 @@ -30,7 +30,7 @@ choice If unsure, select 52xx/6xx/7xx/74xx/82xx/83xx/86xx. config PPC_BOOK3S_6xx - bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx except 601" + bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx" select PPC_BOOK3S_32 select PPC_FPU select PPC_HAVE_PMU_SUPPORT @@ -38,13 +38,6 @@ config PPC_BOOK3S_6xx select PPC_HAVE_KUAP select HAVE_ARCH_VMAP_STACK if !ADB_PMU -config PPC_BOOK3S_601 - bool "PowerPC 601" - select PPC_BOOK3S_32 - select PPC_FPU - select PPC_HAVE_KUAP - select HAVE_ARCH_VMAP_STACK - config PPC_85xx bool "Freescale 85xx" select E500 -- 2.25.0
[PATCH v2 3/7] powerpc: Drop SYNC_601() ISYNC_601() and SYNC()
Those macros are now empty at all time. Drop them. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc_asm.h | 4 arch/powerpc/kernel/entry_32.S | 17 + arch/powerpc/kernel/fpu.S | 1 - arch/powerpc/kernel/head_32.S | 9 - arch/powerpc/kernel/head_32.h | 1 - arch/powerpc/kernel/l2cr_6xx.S | 3 +-- arch/powerpc/mm/book3s32/hash_low.S | 12 7 files changed, 2 insertions(+), 45 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 0b9dc814b81c..67a421b81a50 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -382,10 +382,6 @@ GLUE(.,name): #endif /* various errata or part fixups */ -#defineSYNC -#define SYNC_601 -#define ISYNC_601 - #if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E) #define MFTB(dest) \ 90:mfspr dest, SPRN_TBRL; \ diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index f4d0af8e1136..f25ea188ecd3 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -234,7 +234,6 @@ transfer_to_handler_cont: mtspr SPRN_SRR0,r11 mtspr SPRN_SRR1,r10 mtlrr9 - SYNC RFI /* jump to handler, enable MMU */ #if defined (CONFIG_PPC_BOOK3S_32) || defined(CONFIG_E500) @@ -264,7 +263,6 @@ _ASM_NOKPROBE_SYMBOL(transfer_to_handler_cont) LOAD_REG_IMMEDIATE(r0, MSR_KERNEL) mtspr SPRN_SRR0,r12 mtspr SPRN_SRR1,r0 - SYNC RFI reenable_mmu: @@ -323,7 +321,6 @@ stack_ovf: #endif mtspr SPRN_SRR0,r9 mtspr SPRN_SRR1,r10 - SYNC RFI _ASM_NOKPROBE_SYMBOL(stack_ovf) #endif @@ -411,7 +408,6 @@ ret_from_syscall: /* disable interrupts so current_thread_info()->flags can't change */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL) /* doesn't include MSR_EE */ /* Note: We don't bother telling lockdep about it */ - SYNC mtmsr r10 lwz r9,TI_FLAGS(r2) li r8,-MAX_ERRNO @@ -474,7 +470,6 @@ syscall_exit_finish: #endif mtspr SPRN_SRR0,r7 mtspr SPRN_SRR1,r8 - SYNC RFI _ASM_NOKPROBE_SYMBOL(syscall_exit_finish) #ifdef CONFIG_44x @@ -567,7 +562,6 @@ syscall_exit_work: * lockdep as we are supposed to have IRQs on at this point */ ori r10,r10,MSR_EE - SYNC mtmsr r10 /* Save NVGPRS if they're not saved already */ @@ -606,7 +600,6 @@ ret_from_kernel_syscall: #endif mtspr SPRN_SRR0, r9 mtspr SPRN_SRR1, r10 - SYNC RFI _ASM_NOKPROBE_SYMBOL(ret_from_kernel_syscall) @@ -810,7 +803,6 @@ fast_exception_return: REST_GPR(9, r11) REST_GPR(12, r11) lwz r11,GPR11(r11) - SYNC RFI _ASM_NOKPROBE_SYMBOL(fast_exception_return) @@ -872,7 +864,6 @@ ret_from_except: * from the interrupt. */ /* Note: We don't bother telling lockdep about it */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL) - SYNC/* Some chip revs have problems here... */ mtmsr r10 /* disable interrupts */ lwz r3,_MSR(r1) /* Returning to user mode? */ @@ -1035,7 +1026,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) * exc_exit_restart below. -- paulus */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL & ~MSR_RI) - SYNC mtmsr r10 /* clear the RI bit */ .globl exc_exit_restart exc_exit_restart: @@ -1046,7 +1036,6 @@ exc_exit_restart: lwz r1,GPR1(r1) .globl exc_exit_restart_end exc_exit_restart_end: - SYNC RFI _ASM_NOKPROBE_SYMBOL(exc_exit_restart) _ASM_NOKPROBE_SYMBOL(exc_exit_restart_end) @@ -1274,7 +1263,6 @@ do_resched: /* r10 contains MSR_KERNEL here */ mfmsr r10 #endif ori r10,r10,MSR_EE - SYNC mtmsr r10 /* hard-enable interrupts */ bl schedule recheck: @@ -1283,7 +1271,6 @@ recheck: * TI_FLAGS aren't advertised. */ LOAD_REG_IMMEDIATE(r10,MSR_KERNEL) - SYNC mtmsr r10 /* disable interrupts */ lwz r9,TI_FLAGS(r2) andi. r0,r9,_TIF_NEED_RESCHED @@ -1292,7 +1279,6 @@ recheck: beq restore_user do_user_signal:/* r10 contains MSR_KERNEL here */ ori r10,r10,MSR_EE - SYNC mtmsr r10 /* hard-enable interrupts */ /* save r13-r31 in the exception frame, if not already done */ lwz r3,_TRAP(r1) @@ -1382,8 +1368,7 @@ _GLOBAL(enter_rtas) mfmsr r9 stw r9,8(r1) LOAD_REG_IMMEDIATE(r0,MSR_KERNEL) - SYNC/* disable interrupts so SRR0/1 */ - mtmsr r0
[PATCH v2 1/7] powerpc: Remove SYNC on non 6xx
SYNC is usefull for Powerpc 601 only. On everything else, SYNC is empty. Remove it from code that is not made to run on 6xx. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_40x.S | 1 - arch/powerpc/kernel/head_booke.h | 1 - arch/powerpc/kernel/misc_64.S| 1 - 3 files changed, 3 deletions(-) diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S index 5b282d9965a5..44c9018aed1b 100644 --- a/arch/powerpc/kernel/head_40x.S +++ b/arch/powerpc/kernel/head_40x.S @@ -72,7 +72,6 @@ turn_on_mmu: lis r0,start_here@h ori r0,r0,start_here@l mtspr SPRN_SRR0,r0 - SYNC rfi /* enables MMU */ b . /* prevent prefetch past rfi */ diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index 18f87bf9e32b..71c359d438b5 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h @@ -176,7 +176,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) #endif mtspr SPRN_SRR1,r10 mtspr SPRN_SRR0,r11 - SYNC RFI /* jump to handler, enable MMU */ 99:b ret_from_kernel_syscall .endm diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index 7bb46ad98207..070465825c21 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -365,7 +365,6 @@ _GLOBAL(kexec_smp_wait) li r4,KEXEC_STATE_REAL_MODE stb r4,PACAKEXECSTATE(r13) - SYNC b kexec_wait -- 2.25.0