[PATCH v2] dt-bindings: iommu: Convert msm,iommu-v0 to yaml

2021-12-25 Thread David Heidelberg
Convert Qualcomm IOMMU v0 implementation to yaml format.

Signed-off-by: David Heidelberg 
---
v2:
 - fix wrong path in binding $id
 - comment qcom,mdp4 node example (we don't want to validate it yet)

 .../bindings/iommu/msm,iommu-v0.txt   | 64 -
  .../bindings/iommu/qcom,iommu-v0.yaml | 96 +++
 2 files changed, 96 insertions(+), 64 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iommu/msm,iommu-v0.txt
 create mode 100644 Documentation/devicetree/bindings/iommu/qcom,iommu-v0.yaml

diff --git a/Documentation/devicetree/bindings/iommu/msm,iommu-v0.txt 
b/Documentation/devicetree/bindings/iommu/msm,iommu-v0.txt
deleted file mode 100644
index 20236385f26e..
--- a/Documentation/devicetree/bindings/iommu/msm,iommu-v0.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-* QCOM IOMMU
-
-The MSM IOMMU is an implementation compatible with the ARM VMSA short
-descriptor page tables. It provides address translation for bus masters outside
-of the CPU, each connected to the IOMMU through a port called micro-TLB.
-
-Required Properties:
-
-  - compatible: Must contain "qcom,apq8064-iommu".
-  - reg: Base address and size of the IOMMU registers.
-  - interrupts: Specifiers for the MMU fault interrupts. For instances that
-support secure mode two interrupts must be specified, for non-secure and
-secure mode, in that order. For instances that don't support secure mode a
-single interrupt must be specified.
-  - #iommu-cells: The number of cells needed to specify the stream id. This
- is always 1.
-  - qcom,ncb:The total number of context banks in the IOMMU.
-  - clocks : List of clocks to be used during SMMU register access. See
- Documentation/devicetree/bindings/clock/clock-bindings.txt
- for information about the format. For each clock specified
- here, there must be a corresponding entry in clock-names
- (see below).
-
-  - clock-names: List of clock names corresponding to the clocks 
specified in
- the "clocks" property (above).
- Should be "smmu_pclk" for specifying the interface clock
- required for iommu's register accesses.
- Should be "smmu_clk" for specifying the functional clock
- required by iommu for bus accesses.
-
-Each bus master connected to an IOMMU must reference the IOMMU in its device
-node with the following property:
-
-  - iommus: A reference to the IOMMU in multiple cells. The first cell is a
-   phandle to the IOMMU and the second cell is the stream id.
-   A single master device can be connected to more than one iommu
-   and multiple contexts in each of the iommu. So multiple entries
-   are required to list all the iommus and the stream ids that the
-   master is connected to.
-
-Example: mdp iommu and its bus master
-
-mdp_port0: iommu@750 {
-   compatible = "qcom,apq8064-iommu";
-   #iommu-cells = <1>;
-   clock-names =
-   "smmu_pclk",
-   "smmu_clk";
-   clocks =
-   < SMMU_AHB_CLK>,
-   < MDP_AXI_CLK>;
-   reg = <0x0750 0x10>;
-   interrupts =
-   ,
-   ;
-   qcom,ncb = <2>;
-   };
-
-   mdp: qcom,mdp@510 {
-   compatible = "qcom,mdp";
-   ...
-   iommus = <_port0 0
- _port0 2>;
-   };
diff --git a/Documentation/devicetree/bindings/iommu/qcom,iommu-v0.yaml 
b/Documentation/devicetree/bindings/iommu/qcom,iommu-v0.yaml
new file mode 100644
index ..6f166c30b9ec
--- /dev/null
+++ b/Documentation/devicetree/bindings/iommu/qcom,iommu-v0.yaml
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: "http://devicetree.org/schemas/iommu/qcom,iommu-v0.yaml#;
+$schema: "http://devicetree.org/meta-schemas/core.yaml#;
+
+title: Qualcomm IOMMU for APQ8064
+
+maintainers:
+  - Will Deacon 
+
+description: >
+  The MSM IOMMU is an implementation compatible with the ARM VMSA short
+  descriptor page tables. It provides address translation for bus masters
+  outside of the CPU, each connected to the IOMMU through a port called 
micro-TLB.
+
+properties:
+  compatible:
+const: qcom,apq8064-iommu
+
+  clocks:
+items:
+  - description: interface clock for register accesses
+  - description: functional clock for bus accesses
+
+  clock-names:
+oneOf:
+  - items:
+  - const: smmu_pclk
+  - const: smmu_clk
+  - items:
+  - const: smmu_pclk
+  - const: iommu_clk
+  reg:
+

Re: [PATCH v2 00/33] Separate struct slab from struct page

2021-12-25 Thread Matthew Wilcox
On Sat, Dec 25, 2021 at 09:16:55AM +, Hyeonggon Yoo wrote:
> # mm: Convert struct page to struct slab in functions used by other subsystems
> I'm not familiar with kasan, but to ask:
> Does kasan_slab_free detect invalid free if someone frees
> an object that is not allocated from slab?
> 
> @@ -341,7 +341,7 @@ static inline bool kasan_slab_free(struct kmem_cache 
> *cache, void *object,
> -   if (unlikely(nearest_obj(cache, virt_to_head_page(object), object) !=
> +   if (unlikely(nearest_obj(cache, virt_to_slab(object), object) !=
> object)) {
> kasan_report_invalid_free(tagged_object, ip);
> return true;
> 
> I'm asking this because virt_to_slab() will return NULL if folio_test_slab()
> returns false. That will cause NULL pointer dereference in nearest_obj.
> I don't think this change is intended.

You need to track down how this could happen.  As far as I can tell,
it's always called when we know the object is part of a slab.  That's
where the cachep pointer is deduced from.

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH] dt-bindings: iommu: Convert msm,iommu-v0 to yaml

2021-12-25 Thread Rob Herring
On Fri, 24 Dec 2021 17:50:14 +0100, David Heidelberg wrote:
> Convert Qualcomm IOMMU v0 implementation to yaml format.
> 
> Signed-off-by: David Heidelberg 
> ---
>  .../bindings/iommu/msm,iommu-v0.txt   | 64 -
>  .../bindings/iommu/qcom,iommu-v0.yaml | 96 +++
>  2 files changed, 96 insertions(+), 64 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/iommu/msm,iommu-v0.txt
>  create mode 100644 Documentation/devicetree/bindings/iommu/qcom,iommu-v0.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
./Documentation/devicetree/bindings/iommu/qcom,iommu-v0.yaml: $id: relative 
path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/iommu/qcom,iommu-v0.yaml#
Documentation/devicetree/bindings/iommu/qcom,iommu-v0.example.dts:37.26-43.11: 
Warning (unit_address_vs_reg): /example-0/mdp@510: node has a unit name, 
but no reg or ranges property
Documentation/devicetree/bindings/iommu/qcom,iommu-v0.example.dt.yaml:0:0: 
/example-0/mdp@510: failed to match any schema with compatible: 
['qcom,mdp4']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1573077

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v2 00/33] Separate struct slab from struct page

2021-12-25 Thread Hyeonggon Yoo
On Wed, Dec 22, 2021 at 05:56:50PM +0100, Vlastimil Babka wrote:
> On 12/14/21 13:57, Vlastimil Babka wrote:
> > On 12/1/21 19:14, Vlastimil Babka wrote:
> >> Folks from non-slab subsystems are Cc'd only to patches affecting them, and
> >> this cover letter.
> >>
> >> Series also available in git, based on 5.16-rc3:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=slab-struct_slab-v2r2
> > 
> > Pushed a new branch slab-struct-slab-v3r3 with accumulated fixes and small 
> > tweaks
> > and a new patch from Hyeonggon Yoo on top. To avoid too much spam, here's a 
> > range diff:
> 
> Hi, I've pushed another update branch slab-struct_slab-v4r1, and also to
> -next. I've shortened git commit log lines to make checkpatch happier,
> so no range-diff as it would be too long. I believe it would be useless
> spam to post the whole series now, shortly before xmas, so I will do it
> at rc8 time, to hopefully collect remaining reviews. But if anyone wants
> a mailed version, I can do that.

Hello Vlastimil, Merry Christmas!
This is part 2 of reviewing/testing patches.

# mm/kasan: Convert to struct folio and struct slab
I'm not familiar with kasan yet but kasan runs well on my machine and
kasan's bug report functionality too works fine.
Tested-by: Hyeongogn Yoo <42.hye...@gmail.com>

# mm: Convert struct page to struct slab in functions used by other subsystems
I'm not familiar with kasan, but to ask:
Does kasan_slab_free detect invalid free if someone frees
an object that is not allocated from slab?

@@ -341,7 +341,7 @@ static inline bool kasan_slab_free(struct kmem_cache 
*cache, void *object,
-   if (unlikely(nearest_obj(cache, virt_to_head_page(object), object) !=
+   if (unlikely(nearest_obj(cache, virt_to_slab(object), object) !=
object)) {
kasan_report_invalid_free(tagged_object, ip);
return true;

I'm asking this because virt_to_slab() will return NULL if folio_test_slab()
returns false. That will cause NULL pointer dereference in nearest_obj.
I don't think this change is intended.

This makes me think some of virt_to_head_page() -> virt_to_slab()
conversion need to be reviewed with caution.

# mm/slab: Finish struct page to struct slab conversion
Reviewed-by: Hyeonggon Yoo <42.hye...@gmail.com>

# mm/slab: Convert most struct page to struct slab by spatch
Tested-by: Hyeonggon Yoo <42.hye...@gmail.com>

I'll come back with part 3 :)
Enjoy your Christmas!
Hyeonggon

> Changes in v4:
> - rebase to 5.16-rc6 to avoid a conflict with mainline
> - collect acks/reviews/tested-by from Johannes, Roman, Hyeonggon Yoo -
> thanks!
> - in patch "mm/slub: Convert detached_freelist to use a struct slab"
> renamed free_nonslab_page() to free_large_kmalloc() and use folio there,
> as suggested by Roman
> - in "mm/memcg: Convert slab objcgs from struct page to struct slab"
> change one caller of slab_objcgs_check() to slab_objcgs() as suggested
> by Johannes, realize the other caller should be also changed, and remove
> slab_objcgs_check() completely.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu