Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexander Graf

On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:

 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 
 ---
 Changes:
 2013/07/16:
 * changed the number
 
 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)
 
 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */

so 0xad and 0xaf are already taken? where?

 +/* Available with KVM_CAP_SPAPR_TCE_IOMMU */
 +#define KVM_CREATE_SPAPR_TCE_IOMMU _IOW(KVMIO,  0xaf, struct 
 kvm_create_spapr_tce_iommu)

and why is this one 0xaf then?


Alex

 
 /* ioctl for vm fd */
 #define KVM_CREATE_DEVICE   _IOWR(KVMIO,  0xe0, struct kvm_create_device)
 -- 
 1.8.3.2
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexey Kardashevskiy
On 08/15/2013 05:16 PM, Alexander Graf wrote:
 
 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:
 
 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.

 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

 ---
 Changes:
 2013/07/16:
 * changed the number

 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number

 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)

 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95

 #ifdef KVM_CAP_IRQ_ROUTING

 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR_IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */
 
 so 0xad and 0xaf are already taken? where?

Mistype :( s/af/ae/

They are taken in this file:

1016 /* VM is being stopped by host */
1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct kvm_vcpu_init)

 
 +/* Available with KVM_CAP_SPAPR_TCE_IOMMU */
 +#define KVM_CREATE_SPAPR_TCE_IOMMU _IOW(KVMIO,  0xaf, struct 
 kvm_create_spapr_tce_iommu)
 
 and why is this one 0xaf then?

Sorry, mistype. My bad. Sorry again.


 
 Alex
 

 /* ioctl for vm fd */
 #define KVM_CREATE_DEVICE  _IOWR(KVMIO,  0xe0, struct kvm_create_device)
 -- 
 1.8.3.2

 


-- 
Alexey
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexander Graf

On 15.08.2013, at 09:22, Alexey Kardashevskiy wrote:

 On 08/15/2013 05:16 PM, Alexander Graf wrote:
 
 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:
 
 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 
 ---
 Changes:
 2013/07/16:
 * changed the number
 
 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)
 
 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR   _IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */
 
 so 0xad and 0xaf are already taken? where?
 
 Mistype :( s/af/ae/
 
 They are taken in this file:
 
 1016 /* VM is being stopped by host */
 1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
 1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct 
 kvm_vcpu_init)

Could you please make sure that whoever reads the comment in a year still knows 
where to look? :)

 
 
 +/* Available with KVM_CAP_SPAPR_TCE_IOMMU */
 +#define KVM_CREATE_SPAPR_TCE_IOMMU _IOW(KVMIO,  0xaf, struct 
 kvm_create_spapr_tce_iommu)
 
 and why is this one 0xaf then?
 
 Sorry, mistype. My bad. Sorry again.

No worries - just repost this single patch with the fixed comment.


Alex

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexander Graf

On 15.08.2013, at 09:24, Alexander Graf wrote:

 
 On 15.08.2013, at 09:22, Alexey Kardashevskiy wrote:
 
 On 08/15/2013 05:16 PM, Alexander Graf wrote:
 
 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:
 
 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 
 ---
 Changes:
 2013/07/16:
 * changed the number
 
 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)
 
 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR  _IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */
 
 so 0xad and 0xaf are already taken? where?
 
 Mistype :( s/af/ae/
 
 They are taken in this file:
 
 1016 /* VM is being stopped by host */
 1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
 1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct 
 kvm_vcpu_init)
 
 Could you please make sure that whoever reads the comment in a year still 
 knows where to look? :)

Something like

  /* 0xad is taken by KVM_KVMCLOCK_CTRL */
  /* 0xaf is taken by KVM_ARM_VCPU_INIT */


Alex

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexey Kardashevskiy
On 08/15/2013 05:25 PM, Alexander Graf wrote:
 
 On 15.08.2013, at 09:24, Alexander Graf wrote:
 

 On 15.08.2013, at 09:22, Alexey Kardashevskiy wrote:

 On 08/15/2013 05:16 PM, Alexander Graf wrote:

 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:

 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.

 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

 ---
 Changes:
 2013/07/16:
 * changed the number

 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number

 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)

 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95

 #ifdef KVM_CAP_IRQ_ROUTING

 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */

 so 0xad and 0xaf are already taken? where?

 Mistype :( s/af/ae/

 They are taken in this file:

 1016 /* VM is being stopped by host */
 1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
 1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct 
 kvm_vcpu_init)

 Could you please make sure that whoever reads the comment in a year still 
 knows where to look? :)
 
 Something like
 
   /* 0xad is taken by KVM_KVMCLOCK_CTRL */
   /* 0xaf is taken by KVM_ARM_VCPU_INIT */


Missed this mail and reposted without this comment but updated commit
message saying where they are used. Repost again?



-- 
Alexey
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexander Graf

On 15.08.2013, at 09:42, Alexey Kardashevskiy wrote:

 On 08/15/2013 05:25 PM, Alexander Graf wrote:
 
 On 15.08.2013, at 09:24, Alexander Graf wrote:
 
 
 On 15.08.2013, at 09:22, Alexey Kardashevskiy wrote:
 
 On 08/15/2013 05:16 PM, Alexander Graf wrote:
 
 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:
 
 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 
 ---
 Changes:
 2013/07/16:
 * changed the number
 
 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)
 
 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR_IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */
 
 so 0xad and 0xaf are already taken? where?
 
 Mistype :( s/af/ae/
 
 They are taken in this file:
 
 1016 /* VM is being stopped by host */
 1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
 1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct 
 kvm_vcpu_init)
 
 Could you please make sure that whoever reads the comment in a year still 
 knows where to look? :)
 
 Something like
 
  /* 0xad is taken by KVM_KVMCLOCK_CTRL */
  /* 0xaf is taken by KVM_ARM_VCPU_INIT */
 
 
 Missed this mail and reposted without this comment but updated commit
 message saying where they are used. Repost again?

The commit message doesn't really help, since you don't see that one when you 
read the header file later. So yes, please.


Alex

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v8] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexey Kardashevskiy
This is to reserve a capablity number for upcoming support
of VFIO-IOMMU DMA operations in real mode.

The last ioctl in the group which KVM_CREATE_SPAPR_TCE_IOMMU is added to
is 0xac, the next two numbers are taken - 0xad for KVM_KVMCLOCK_CTRL and
0xae for KVM_ARM_VCPU_INIT. So the KVM_CREATE_SPAPR_TCE_IOMMU ioclt gets
0xaf.

Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

---
Changes:
2013/08/15 v8:
* fixed comment again

2013/08/15:
* fixed mistype in comments
* fixed commit message which says what uses ioctls 0xad and 0xae

2013/07/16:
* changed the number

2013/07/11:
* changed order in a file, added comment about a gap in ioctl number
---
 include/uapi/linux/kvm.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 99c2533..bd94127 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
+#define KVM_CAP_SPAPR_TCE_IOMMU 95
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -933,6 +934,11 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR  _IOW(KVMIO,  0xab, struct 
kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
kvm_rtas_token_args)
+/* 0xad is taken by KVM_KVMCLOCK_CTRL */
+/* 0xae is taken by KVM_ARM_VCPU_INIT */
+/* Available with KVM_CAP_SPAPR_TCE_IOMMU */
+#define KVM_CREATE_SPAPR_TCE_IOMMU _IOW(KVMIO,  0xaf, \
+   struct kvm_create_spapr_tce_iommu)
 
 /* ioctl for vm fd */
 #define KVM_CREATE_DEVICE_IOWR(KVMIO,  0xe0, struct kvm_create_device)
-- 
1.8.3.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexey Kardashevskiy
On 08/15/2013 05:43 PM, Alexander Graf wrote:
 
 On 15.08.2013, at 09:42, Alexey Kardashevskiy wrote:
 
 On 08/15/2013 05:25 PM, Alexander Graf wrote:

 On 15.08.2013, at 09:24, Alexander Graf wrote:


 On 15.08.2013, at 09:22, Alexey Kardashevskiy wrote:

 On 08/15/2013 05:16 PM, Alexander Graf wrote:

 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:

 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.

 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

 ---
 Changes:
 2013/07/16:
 * changed the number

 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number

 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)

 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95

 #ifdef KVM_CAP_IRQ_ROUTING

 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR   _IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */

 so 0xad and 0xaf are already taken? where?

 Mistype :( s/af/ae/

 They are taken in this file:

 1016 /* VM is being stopped by host */
 1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
 1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct 
 kvm_vcpu_init)

 Could you please make sure that whoever reads the comment in a year still 
 knows where to look? :)

 Something like

  /* 0xad is taken by KVM_KVMCLOCK_CTRL */
  /* 0xaf is taken by KVM_ARM_VCPU_INIT */


 Missed this mail and reposted without this comment but updated commit
 message saying where they are used. Repost again?
 
 The commit message doesn't really help, since you don't see that one when you 
 read the header file later. So yes, please.


Ok. Reposted as [PATCH v8] KVM: PPC: reserve a capability and ioctl
numbers for realmode VFIO. Thank you. Sorry for my disturbing ignorance.


-- 
Alexey
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 03/10] KVM: PPC: reserve a capability and ioctl numbers for realmode VFIO

2013-08-15 Thread Alexander Graf

On 15.08.2013, at 09:54, Alexey Kardashevskiy wrote:

 On 08/15/2013 05:43 PM, Alexander Graf wrote:
 
 On 15.08.2013, at 09:42, Alexey Kardashevskiy wrote:
 
 On 08/15/2013 05:25 PM, Alexander Graf wrote:
 
 On 15.08.2013, at 09:24, Alexander Graf wrote:
 
 
 On 15.08.2013, at 09:22, Alexey Kardashevskiy wrote:
 
 On 08/15/2013 05:16 PM, Alexander Graf wrote:
 
 On 01.08.2013, at 06:44, Alexey Kardashevskiy wrote:
 
 This is to reserve a capablity number for upcoming support
 of VFIO-IOMMU DMA operations in real mode.
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 
 ---
 Changes:
 2013/07/16:
 * changed the number
 
 2013/07/11:
 * changed order in a file, added comment about a gap in ioctl number
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
 ---
 include/uapi/linux/kvm.h | 4 
 1 file changed, 4 insertions(+)
 
 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
 index 99c2533..53c3f1f 100644
 --- a/include/uapi/linux/kvm.h
 +++ b/include/uapi/linux/kvm.h
 @@ -668,6 +668,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_IRQ_XICS 92
 #define KVM_CAP_ARM_EL1_32BIT 93
 #define KVM_CAP_SPAPR_MULTITCE 94
 +#define KVM_CAP_SPAPR_TCE_IOMMU 95
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
 @@ -933,6 +934,9 @@ struct kvm_s390_ucas_mapping {
 #define KVM_ARM_SET_DEVICE_ADDR  _IOW(KVMIO,  0xab, struct 
 kvm_arm_device_addr)
 /* Available with KVM_CAP_PPC_RTAS */
 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO,  0xac, struct 
 kvm_rtas_token_args)
 +/* 0xad and 0xaf are already taken */
 
 so 0xad and 0xaf are already taken? where?
 
 Mistype :( s/af/ae/
 
 They are taken in this file:
 
 1016 /* VM is being stopped by host */
 1017 #define KVM_KVMCLOCK_CTRL _IO(KVMIO,   0xad)
 1018 #define KVM_ARM_VCPU_INIT _IOW(KVMIO,  0xae, struct 
 kvm_vcpu_init)
 
 Could you please make sure that whoever reads the comment in a year still 
 knows where to look? :)
 
 Something like
 
 /* 0xad is taken by KVM_KVMCLOCK_CTRL */
 /* 0xaf is taken by KVM_ARM_VCPU_INIT */
 
 
 Missed this mail and reposted without this comment but updated commit
 message saying where they are used. Repost again?
 
 The commit message doesn't really help, since you don't see that one when 
 you read the header file later. So yes, please.
 
 
 Ok. Reposted as [PATCH v8] KVM: PPC: reserve a capability and ioctl
 numbers for realmode VFIO. Thank you. Sorry for my disturbing ignorance.

In this case it's just sloppyness which disturbs be a lot less, as I'm sloppy 
myself :).


Alex

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] Revert cxgb3: Check and handle the dma mapping errors

2013-08-15 Thread David Miller
From: Divy Le ray d...@chelsio.com
Date: Wed, 14 Aug 2013 08:57:24 -0700

 On 08/14/2013 02:19 AM, Alexey Kardashevskiy wrote:
 This reverts commit f83331bab149e29fa2c49cf102c0cd8c3f1ce9f9.

 As the tests PPC64 (powernv platform) show, IOMMU pages are leaking
 when transferring big amount of small packets (=64 bytes),
 ping -f and waiting for 15 seconds is the simplest way to confirm
 the bug.

 Cc: Linus Torvaldstorva...@linux-foundation.org
 Cc: Santosh Rastapursant...@chelsio.com
 Cc: Jay Fenlasonfenla...@redhat.com
 Cc: David S. Millerda...@davemloft.net
 Cc: Divy Le rayd...@chelsio.com
 Signed-off-by: Alexey Kardashevskiya...@ozlabs.ru
 
 Acked-by: Divy Le Ray d...@chelsio.com

Applied, thanks.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH v4 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver

2013-08-15 Thread Shawn Guo
On Thu, Aug 15, 2013 at 10:18:23AM +0800, Nicolin Chen wrote:
 Hi Stephen,
 
 On Wed, Aug 14, 2013 at 09:47:19AM -0600, Stephen Warren wrote:
  If the clock source name list is different, then it needs a different
  compatible value, so that each compatible value can specify which clock
  names are required.
  
  Also, the compatible value itself should always include the exact HW
  that's present (most specific HW version), as well as any other HW it's
  compatible with.
  
 Thank you for the comments. Yes, I did so in v1-v3, but after rethinking
 about the situation (Actually both the HW version and the clock mux itself
 are same, just the clock sources connecting to the mux might be different),
 so I decided to do this by abstracting the driver from those source info
 and letting DT binding to pass such information. Because I think putting 
 the clock sources into the driver differed by compatible value would make
 the driver more like SoC-specified, not the ideal way -- SoC-independent,
 since the clock sources are based on SoC design, not on itself.

+1

It's pretty much the differences at SoC integration level not the IP
itself, and it just happens to be handled in a register of the IP.

Shawn

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v5 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver

2013-08-15 Thread Nicolin Chen
This patch add S/PDIF controller driver for Freescale SoC.

Signed-off-by: Nicolin Chen b42...@freescale.com
---
 .../devicetree/bindings/sound/fsl,spdif.txt|   76 ++
 sound/soc/fsl/Kconfig  |3 +
 sound/soc/fsl/Makefile |2 +
 sound/soc/fsl/fsl_spdif.c  | 1336 
 sound/soc/fsl/fsl_spdif.h  |  224 
 5 files changed, 1641 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,spdif.txt
 create mode 100644 sound/soc/fsl/fsl_spdif.c
 create mode 100644 sound/soc/fsl/fsl_spdif.h

diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt 
b/Documentation/devicetree/bindings/sound/fsl,spdif.txt
new file mode 100644
index 000..301b827
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt
@@ -0,0 +1,76 @@
+Freescale Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Freescale S/PDIF audio block is a stereo transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+
+Required properties:
+
+  - compatible : Compatible list, contains fsl,chip-spdif.
+
+  - reg : Offset and length of the register set for the device.
+
+  - interrupts : Contains spdif interrupt.
+
+  - dmas : Generic dma devicetree binding as described in
+  Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names : Two dmas have to be defined, tx and rx.
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names : Includes the following entries:
+   nametypecomments
+   core  RequiredThe core clock of spdif controller
+
+   rxOptionalRx clock source for spdif record.
+   If absent, will use core clock.
+
+   txOptionalTx clock source for spdif playback.
+   If absent, will use core clock.
+
+   tx-32000  OptionalTx clock source for 32000Hz sample rate
+   playback. If absent, will use tx clock.
+
+   tx-44100  OptionalTx clock source for 44100Hz sample rate
+   playback. If absent, will use tx clock.
+
+   tx-48000  OptionalTx clock source for 48000Hz sample rate
+   playback. If absent, will use tx clock.
+
+   src0-7  OptionalClock source list for tx and rx clock
+   to look up their clock source indexes.
+   This clock list should be identical to
+   the list of TxClk_Source bit value of
+   register SPDIF_STC. If absent or failed
+   to look up, tx and rx clock would then
+   ignore the rx, tx tx-32000,
+   tx-44100, tx-48000 clock phandles
+   and select the core clock as default
+   tx and rx clock.
+
+Optional properties:
+
+  - rx-clksrc-lock: This is a boolean property. If present, ClkSrc_Sel bit
+  of SPDIF_SRPC would be set a clock source that cares DPLL locked condition.
+
+Example:
+
+spdif: spdif@02004000 {
+   compatible = fsl,imx6q-spdif,
+   fsl,imx35-spdif;
+   reg = 0x02004000 0x4000;
+   interrupts = 0 52 0x04;
+   dmas = sdma 14 18 0,
+  sdma 15 18 0;
+   dma-names = rx, tx;
+
+   clocks = clks 197, clks 3, clks 197,
+  clks 107, clks 118, clks 62,
+  clks 139;
+   clock-names = core, src0, src1, src2,
+   src4, src5, src6;
+   rx-clksrc-lock;
+
+   status = okay;
+};
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index e15f771..2c518db 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -1,6 +1,9 @@
 config SND_SOC_FSL_SSI
tristate
 
+config SND_SOC_FSL_SPDIF
+   tristate
+
 config SND_SOC_FSL_UTILS
tristate
 
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index d4b4aa8..4b5970e 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -12,9 +12,11 @@ obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o
 
 # Freescale PowerPC SSI/DMA Platform Support
 snd-soc-fsl-ssi-objs := fsl_ssi.o
+snd-soc-fsl-spdif-objs := fsl_spdif.o
 snd-soc-fsl-utils-objs := fsl_utils.o
 snd-soc-fsl-dma-objs := fsl_dma.o
 obj-$(CONFIG_SND_SOC_FSL_SSI) += snd-soc-fsl-ssi.o
+obj-$(CONFIG_SND_SOC_FSL_SPDIF) += snd-soc-fsl-spdif.o
 obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o
 obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o
 
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
new file mode 100644

[PATCH v5 0/2] Add freescale S/PDIF CPU DAI and machine drivers

2013-08-15 Thread Nicolin Chen
Changelog:
v4-v5:
 * Dropped rx/tx-clksrc-names DT bindings.
 * Use standard clock binding instead to pass the clock source list.
 * Update the compatible list by using imx35, the first SoC that has spdif.
v3-v4:
 * Use regmap for CPU DAI driver.
 * Use individual clock source for 32KHz, 44KHz, 48KHz playback.
 * Determine clock source configuration from 'clocks' entry.
 * Added imx53 to compatible list, merged imx6q and imx6dl in the list.
 * Improve the algorism of reverse_bits().
 * Dropped the unneeded clk_put().
v2-v3:
 * Removed a wrong tag from the commit of patch-1.
v1-v2:
 * Dropped one applied patch for spdif dummy codec drivers.
 * Use generic DMA DT binding.
 * Let spdif controller driver calculate the clock div.
 * Added one optional clock source for spdif tx.
 * Reivsed documentation accordingly.


Nicolin Chen (2):
  ASoC: fsl: Add S/PDIF CPU DAI driver
  ASoC: fsl: Add S/PDIF machine driver

 .../devicetree/bindings/sound/fsl,spdif.txt|   76 ++
 .../devicetree/bindings/sound/imx-audio-spdif.txt  |   29 +
 sound/soc/fsl/Kconfig  |   14 +
 sound/soc/fsl/Makefile |4 +
 sound/soc/fsl/fsl_spdif.c  | 1336 
 sound/soc/fsl/fsl_spdif.h  |  224 
 sound/soc/fsl/imx-spdif.c  |  134 ++
 7 files changed, 1817 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,spdif.txt
 create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
 create mode 100644 sound/soc/fsl/fsl_spdif.c
 create mode 100644 sound/soc/fsl/fsl_spdif.h
 create mode 100644 sound/soc/fsl/imx-spdif.c


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v5 2/2] ASoC: fsl: Add S/PDIF machine driver

2013-08-15 Thread Nicolin Chen
Add S/PDIF machine driver for Freescale i.MX series SoC.

Signed-off-by: Nicolin Chen b42...@freescale.com
---
 .../devicetree/bindings/sound/imx-audio-spdif.txt  |   29 +
 sound/soc/fsl/Kconfig  |   11 ++
 sound/soc/fsl/Makefile |2 +
 sound/soc/fsl/imx-spdif.c  |  134 
 4 files changed, 176 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
 create mode 100644 sound/soc/fsl/imx-spdif.c

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-spdif.txt 
b/Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
new file mode 100644
index 000..9a3fa26
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
@@ -0,0 +1,29 @@
+Freescale i.MX audio complex with S/PDIF transceiver
+
+Required properties:
+
+  - compatible : fsl,imx-audio-spdif
+
+  - model : The user-visible name of this sound complex
+
+  - spdif-controller : The phandle of the i.MX S/PDIF controller
+
+
+Optional properties:
+
+  - spdif-transmitter : The phandle of the spdif-transmitter dummy codec
+
+  - spdif-receiver : The phandle of the spdif-receiver dummy codec
+
+* Note: At least one of these two properties should be set in the DT binding.
+
+
+Example:
+
+sound-spdif {
+   compatible = fsl,imx-audio-spdif;
+   model = imx-spdif;
+   spdif-controller = spdif;
+   spdif-transmitter = spdif_tx_codec;
+   spdif-receiver = spdif_rx_codec;
+};
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 2c518db..4cc118c 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -195,6 +195,17 @@ config SND_SOC_IMX_SGTL5000
  Say Y if you want to add support for SoC audio on an i.MX board with
  a sgtl5000 codec.
 
+config SND_SOC_IMX_SPDIF
+   tristate SoC Audio support for i.MX boards with S/PDIF
+   select SND_SOC_IMX_PCM_DMA
+   select SND_SOC_FSL_SPDIF
+   select SND_SOC_FSL_UTILS
+   select SND_SOC_SPDIF
+   help
+ SoC Audio support for i.MX boards with S/PDIF
+ Say Y if you want to add support for SoC audio on an i.MX board with
+ a S/DPDIF.
+
 config SND_SOC_IMX_MC13783
tristate SoC Audio support for I.MX boards with mc13783
depends on MFD_MC13783  ARM
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 4b5970e..e2aaff7 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -45,6 +45,7 @@ snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
 snd-soc-wm1133-ev1-objs := wm1133-ev1.o
 snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o
 snd-soc-imx-wm8962-objs := imx-wm8962.o
+snd-soc-imx-spdif-objs :=imx-spdif.o
 snd-soc-imx-mc13783-objs := imx-mc13783.o
 
 obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
@@ -53,4 +54,5 @@ obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += 
snd-soc-mx27vis-aic32x4.o
 obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o
 obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o
 obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o
+obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o
 obj-$(CONFIG_SND_SOC_IMX_MC13783) += snd-soc-imx-mc13783.o
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
new file mode 100644
index 000..893f3d1
--- /dev/null
+++ b/sound/soc/fsl/imx-spdif.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include linux/module.h
+#include linux/of_platform.h
+#include sound/soc.h
+
+struct imx_spdif_data {
+   struct snd_soc_dai_link dai[2];
+   struct snd_soc_card card;
+};
+
+static int imx_spdif_audio_probe(struct platform_device *pdev)
+{
+   struct device_node *np = pdev-dev.of_node;
+   struct device_node *spdif_np, *codec_tx_np, *codec_rx_np;
+   struct platform_device *spdif_pdev;
+   struct imx_spdif_data *data;
+   int ret = 0, num_links = 0;
+
+   spdif_np = of_parse_phandle(np, spdif-controller, 0);
+   if (!spdif_np) {
+   dev_err(pdev-dev, failed to find spdif-controller\n);
+   ret = -EINVAL;
+   goto fail;
+   }
+
+   spdif_pdev = of_find_device_by_node(spdif_np);
+   if (!spdif_pdev) {
+   dev_err(pdev-dev, failed to find S/PDIF device\n);
+   ret = -EINVAL;
+   goto fail;
+   }
+
+   data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
+   if (!data) {
+   dev_err(pdev-dev, failed to allocate memory\n);
+   ret = -ENOMEM;
+   goto fail;
+   }
+
+   codec_tx_np = of_parse_phandle(np, 

[PATCH v2 3/3] powerpc: check CPU_FTR_COHERENT_ICACHE in __flush_dcache_icache for 64bit kernel

2013-08-15 Thread Kevin Hao
We don't need to flush the dcache and invalidate the icache on the
CPU which has CPU_FTR_COHERENT_ICACHE set. Also add the missing
required isync in this case.

Signed-off-by: Kevin Hao haoke...@gmail.com
---
v2: Add the isync.

 arch/powerpc/kernel/misc_64.S | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 971d7e7..992a78e 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -207,6 +207,10 @@ _GLOBAL(flush_inval_dcache_range)
  * void __flush_dcache_icache(void *page)
  */
 _GLOBAL(__flush_dcache_icache)
+BEGIN_FTR_SECTION
+   isync
+   blr
+END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
 /*
  * Flush the data cache to memory 
  * 
-- 
1.8.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc: add the missing required isync for the coherent icache flush

2013-08-15 Thread Kevin Hao
Even we don't need to flush the dcache and invalidate the icache
on the CPU which has coherent icache. But we do need an isync to
discard the prefetched instructions in this case.

Signed-off-by: Kevin Hao haoke...@gmail.com
---
 arch/powerpc/kernel/misc_32.S | 2 ++
 arch/powerpc/kernel/misc_64.S | 1 +
 2 files changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 777d999..0b84c8d 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -433,6 +433,7 @@ _GLOBAL(invalidate_dcache_range)
  */
 _GLOBAL(__flush_dcache_icache)
 BEGIN_FTR_SECTION
+   isync
blr
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
rlwinm  r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */
@@ -474,6 +475,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_44x)
  */
 _GLOBAL(__flush_dcache_icache_phys)
 BEGIN_FTR_SECTION
+   isync
blr /* for 601, do nothing */
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
mfmsr   r10
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 992a78e..d74fefb 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -69,6 +69,7 @@ PPC64_CACHES:
 
 _KPROBE(flush_icache_range)
 BEGIN_FTR_SECTION
+   isync
blr
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
 /*
-- 
1.8.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v3 0/7] net: use platform_{get,set}_drvdata()

2013-08-15 Thread Libo Chen
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with pdev-dev,
so we can directly pass a struct platform_device.

changelog v3:
remove modify about dev_set_drvdata()
changelog v2:
this version add modify record about dev_set_drvdata().

Libo Chen (7):
  net: fsl_pq_mdio: use platform_{get,set}_drvdata()
  net: ucc_geth: use platform_{get,set}_drvdata()
  net: fec_mpc52xx_phy: use platform_{get,set}_drvdata()
  net: sunbmac: use platform_{get,set}_drvdata()
  net: sunhme: use platform_{get,set}_drvdata()
  net: xilinx_emaclite: use platform_{get,set}_drvdata()
  net: davinci_mdio: use platform_{get,set}_drvdata()

 drivers/net/ethernet/freescale/fec_mpc52xx_phy.c |3 +--
 drivers/net/ethernet/freescale/fsl_pq_mdio.c |2 +-
 drivers/net/ethernet/freescale/ucc_geth.c|3 +--
 drivers/net/ethernet/sun/sunbmac.c   |2 +-
 drivers/net/ethernet/sun/sunhme.c|6 +++---
 drivers/net/ethernet/ti/davinci_mdio.c   |3 +--
 drivers/net/ethernet/xilinx/xilinx_emaclite.c|3 +--
 7 files changed, 9 insertions(+), 13 deletions(-)


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v3 2/7] net: ucc_geth: use platform_{get,set}_drvdata()

2013-08-15 Thread Libo Chen
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with ofdev-dev,
so we can directly pass a struct platform_device.

Signed-off-by: Libo Chen libo.c...@huawei.com
---
 drivers/net/ethernet/freescale/ucc_geth.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c 
b/drivers/net/ethernet/freescale/ucc_geth.c
index 3c43dac..533885c 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3911,8 +3911,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)

 static int ucc_geth_remove(struct platform_device* ofdev)
 {
-   struct device *device = ofdev-dev;
-   struct net_device *dev = dev_get_drvdata(device);
+   struct net_device *dev = platform_get_drvdata(ofdev);
struct ucc_geth_private *ugeth = netdev_priv(dev);

unregister_netdev(dev);
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 00/10] Getting rid of get_unused_fd_flags()

2013-08-15 Thread Yann Droneaud
Hi,

Macro get_unused_fd() is a shortcut to call function get_unused_fd_flags(),
to allocate a file descriptor.

The macro use 0 as flags, so the file descriptor is created
without O_CLOEXEC flag.

This can be seen as an unsafe default eg. in most case O_CLOEXEC
must be used to not leak file descriptor across exec().

Newer kernel code should use anon_inode_getfd() or get_unused_fd_flags()
with flags provided by userspace. If flags cannot be given by userspace,
O_CLOEXEC must be the default flag.

Using O_CLOEXEC by default allows userspace to choose, without race,
if the file descriptor is going to be inherited across exec().

They are two ways to achieve this:

- makes get_unused_fd() use O_CLOEXEC by default

  It's difficult to get it right: every code using of get_unused_fd()
  must take this change into account and be fixed as soon as
  macro get_unused_fd() do the switch. Non updated code will have
  unexpected behavor and it's likely going to break API contract.

- remove get_unused_fd()

  It's going to break some out of tree, not yet upstream kernel code,
  but it's easy to notice and fix. Anyway, newer code should use
  anon_inode_getfd() or get_unused_fd_flags().

The latter option was choosen to ensure no unexpected behavor
for out of tree, not yet upstream code. Removing the macro is the safest
choice: it's better to break build than trying to make get_unused_fd()
use O_CLOEXEC by default and get all user of get_unused_fd() update.

Additionnaly, removing the macro is not going to break modules ABI.

In linux-next tag 20130815, they're currently:

- 19 calls to get_unused_fd_flags() (+4)
 not counting get_unused_fd() and anon_inode_getfd()
- 10 calls to get_unused_fd()   (-4)
- 11 calls to anon_inode_getfd()(0)

The following patchset try to convert all calls to get_unused_fd()
to get_unused_fd_flags(0) before removing get_unused_fd() macro.

Without get_unused_fd() macro, more subsystems are likely to use
anon_inode_getfd() and be teached to provide an API that let userspace
choose the opening flags of the file descriptor.

Changes from v1 
http://lkml.kernel.org/r/cover.1372777600.git.ydrone...@opteya.com:

- explicitly added subsystem maintainers as mail recepients.

- infiniband: use get_unused_fd_flags(0) instead of get_unused_fd()
  DROPPED: subsystem maintainer applied another patch using
   get_unused_fd_flags(O_CLOEXEC) as suggested.

- android/sw_sync: use get_unused_fd_flags(0) instead of get_unused_fd()
  MODIFIED: use get_unused_fd_flags(O_CLOEXEC) as suggested by
  
http://lkml.kernel.org/r/cacsp8sjxgmk2_kx_+rgzqqqwqkernvf1wt3k5tw991w5dfa...@mail.gmail.com

- android/sync: use get_unused_fd_flags(0) instead of get_unused_fd()
  MODIFIED: use get_unused_fd_flags(O_CLOEXEC) as suggested by
  
http://lkml.kernel.org/r/CACSP8SjZcpcpEtQHzcGYhf-MP7QGo0XpN7-uN7rmD=vNtopG=w...@mail.gmail.com

- xfs: use get_unused_fd_flags(0) instead of get_unused_fd()
  DROPPED: applied asis by subsystem maintainer.

- sctp: use get_unused_fd_flags(0) instead of get_unused_fd()
  DROPPED: applied asis by subsystem maintainer.

Yann Droneaud (10):
  ia64: use get_unused_fd_flags(0) instead of get_unused_fd()
  ppc/cell: use get_unused_fd_flags(0) instead of get_unused_fd()
  android/sw_sync: use get_unused_fd_flags(O_CLOEXEC) instead of
get_unused_fd()
  android/sync: use get_unused_fd_flags(O_CLOEXEC) instead of
get_unused_fd()
  vfio: use get_unused_fd_flags(0) instead of get_unused_fd()
  binfmt_misc: use get_unused_fd_flags(0) instead of get_unused_fd()
  file: use get_unused_fd_flags(0) instead of get_unused_fd()
  fanotify: use get_unused_fd_flags(0) instead of get_unused_fd()
  events: use get_unused_fd_flags(0) instead of get_unused_fd()
  file: remove get_unused_fd()

 arch/ia64/kernel/perfmon.c| 2 +-
 arch/powerpc/platforms/cell/spufs/inode.c | 4 ++--
 drivers/staging/android/sw_sync.c | 2 +-
 drivers/staging/android/sync.c| 2 +-
 drivers/vfio/vfio.c   | 2 +-
 fs/binfmt_misc.c  | 2 +-
 fs/file.c | 2 +-
 fs/notify/fanotify/fanotify_user.c| 2 +-
 include/linux/file.h  | 1 -
 kernel/events/core.c  | 2 +-
 10 files changed, 10 insertions(+), 11 deletions(-)

-- 
1.8.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 02/10] ppc/cell: use get_unused_fd_flags(0) instead of get_unused_fd()

2013-08-15 Thread Yann Droneaud
Macro get_unused_fd() is used to allocate a file descriptor with
default flags. Those default flags (0) can be unsafe:
O_CLOEXEC must be used by default to not leak file descriptor
across exec().

Instead of macro get_unused_fd(), functions anon_inode_getfd()
or get_unused_fd_flags() should be used with flags given by userspace.
If not possible, flags should be set to O_CLOEXEC to provide userspace
with a default safe behavor.

In a further patch, get_unused_fd() will be removed so that
new code start using anon_inode_getfd() or get_unused_fd_flags()
with correct flags.

This patch replaces calls to get_unused_fd() with equivalent call to
get_unused_fd_flags(0) to preserve current behavor for existing code.

The hard coded flag value (0) should be reviewed on a per-subsystem basis,
and, if possible, set to O_CLOEXEC.

Signed-off-by: Yann Droneaud ydrone...@opteya.com
Link: http://lkml.kernel.org/r/cover.1376327678.git.ydrone...@opteya.com

---
 arch/powerpc/platforms/cell/spufs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/inode.c 
b/arch/powerpc/platforms/cell/spufs/inode.c
index f390042..88df441 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -301,7 +301,7 @@ static int spufs_context_open(struct path *path)
int ret;
struct file *filp;
 
-   ret = get_unused_fd();
+   ret = get_unused_fd_flags(0);
if (ret  0)
return ret;
 
@@ -518,7 +518,7 @@ static int spufs_gang_open(struct path *path)
int ret;
struct file *filp;
 
-   ret = get_unused_fd();
+   ret = get_unused_fd_flags(0);
if (ret  0)
return ret;
 
-- 
1.8.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC PATCH 0/4] DT: move of_get_cpu_node from PPC to DT core

2013-08-15 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Hi,

This series needs to be prepended with the original series[1][2][3]
Except the first patch in the original series(which is merged into this
as last patch), there is no other change(apart from function signature)
I am posting only this part for feedback separately for review as the
original series is already reviewed. Once this part is review and aknowledged
I will combine the complete series and post it.

Hi Rob,

Since the compatible 'ibm,ppc-interrupt-server#s' is one-off and for
historical reasons, if future architectures are adhering to ePAPR,
IMO having a weak definition of arch_of_cpu_get_node as you suggested
could lead to it's misuse in future. So I didn't take that approach.

Regards,
Sudeep

Sudeep KarkadaNagesha (4):
  microblaze: remove undefined of_get_cpu_node declaration
  openrisc: remove undefined of_get_cpu_node declaration
  powerpc: refactor of_get_cpu_node to support other architectures
  of: move of_get_cpu_node implementation to DT core library

 arch/microblaze/include/asm/prom.h |  3 --
 arch/openrisc/include/asm/prom.h   |  3 --
 arch/powerpc/include/asm/prom.h|  3 --
 arch/powerpc/kernel/prom.c | 43 +
 drivers/of/base.c  | 94 ++
 include/linux/cpu.h|  1 +
 include/linux/of.h |  7 +++
 7 files changed, 104 insertions(+), 50 deletions(-)

-- 
1.8.1.2

[1] https://lkml.org/lkml/2013/7/15/128
[2] https://lkml.org/lkml/2013/7/17/341
[3] https://lkml.org/lkml/2013/7/22/219

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC PATCH 2/4] openrisc: remove undefined of_get_cpu_node declaration

2013-08-15 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

This patch removes the declaration of the function 'of_get_cpu_node'
which is not defined for openrisc. This is in preparation to move
it's definition from PPC to DT common code.

Again it could be there as it was originally copied from powerpc.

Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
Cc: Jonas Bonn jo...@southpole.se
---
 arch/openrisc/include/asm/prom.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h
index bbb34e5..eb59bfe 100644
--- a/arch/openrisc/include/asm/prom.h
+++ b/arch/openrisc/include/asm/prom.h
@@ -44,9 +44,6 @@ void of_parse_dma_window(struct device_node *dn, const void 
*dma_window_prop,
 
 extern void kdump_move_device_tree(void);
 
-/* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
-
 /* Get the MAC address */
 extern const void *of_get_mac_address(struct device_node *np);
 
-- 
1.8.1.2


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC PATCH 1/4] microblaze: remove undefined of_get_cpu_node declaration

2013-08-15 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

This patch removes the declaration of the function 'of_get_cpu_node'
which is not defined for microblaze. This is in preparation to move
it's definition from PPC to DT common code.

Michal Simek says: it was just there because Microblaze
was based on powerpc code

Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
Cc: Michal Simek mon...@monstr.eu
---
 arch/microblaze/include/asm/prom.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h 
b/arch/microblaze/include/asm/prom.h
index 20c5e8e..9977816 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -50,9 +50,6 @@ void of_parse_dma_window(struct device_node *dn, const void 
*dma_window_prop,
 
 extern void kdump_move_device_tree(void);
 
-/* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
-
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 
-- 
1.8.1.2


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC PATCH 4/4] of: move of_get_cpu_node implementation to DT core library

2013-08-15 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

This patch moves the generalized implementation of of_get_cpu_node from
PowerPC to DT core library, thereby adding support for retrieving cpu
node for a given logical cpu index on any architecture.

The CPU subsystem can now use this function to assign of_node in the
cpu device while registering CPUs.

It is recommended to use these helper function only in pre-SMP/early
initialisation stages to retrieve CPU device node pointers in logical
ordering. Once the cpu devices are registered, it can be retrieved easily
from cpu device of_node which avoids unnecessary parsing and matching.

Cc: Rob Herring rob.herr...@calxeda.com
Cc: Grant Likely grant.lik...@linaro.org
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/powerpc/include/asm/prom.h |  3 --
 arch/powerpc/kernel/prom.c  | 55 
 drivers/of/base.c   | 94 +
 include/linux/cpu.h |  1 +
 include/linux/of.h  |  7 +++
 5 files changed, 102 insertions(+), 58 deletions(-)

diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index bc2da15..ac204e0 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -43,9 +43,6 @@ void of_parse_dma_window(struct device_node *dn, const void 
*dma_window_prop,
 
 extern void kdump_move_device_tree(void);
 
-/* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
-
 /* cache lookup */
 struct device_node *of_find_next_cache_node(struct device_node *np);
 
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 594c9f9..1c14cd4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -870,61 +870,6 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
return (int)phys_id == get_hard_smp_processor_id(cpu);
 }
 
-static bool __of_find_n_match_cpu_property(struct device_node *cpun,
-   const char *prop_name, int cpu, unsigned int *thread)
-{
-   const __be32 *cell;
-   int ac, prop_len, tid;
-   u64 hwid;
-
-   ac = of_n_addr_cells(cpun);
-   cell = of_get_property(cpun, prop_name, prop_len);
-   if (!cell)
-   return false;
-   prop_len /= sizeof(*cell);
-   for (tid = 0; tid  prop_len; tid++) {
-   hwid = of_read_number(cell, ac);
-   if (arch_match_cpu_phys_id(cpu, hwid)) {
-   if (thread)
-   *thread = tid;
-   return true;
-   }
-   }
-   return false;
-}
-
-/* Find the device node for a given logical cpu number, also returns the cpu
- * local thread number (index in ibm,interrupt-server#s) if relevant and
- * asked for (non NULL)
- */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
-{
-   struct device_node *cpun, *cpus;
-
-   cpus = of_find_node_by_path(/cpus);
-   if (!cpus) {
-   pr_warn(Missing cpus node, bailing out\n);
-   return NULL;
-   }
-
-   for_each_child_of_node(cpus, cpun) {
-   if (of_node_cmp(cpun-type, cpu))
-   continue;
-
-   /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
-* fallback to reg property and assume no threads
-*/
-   if (__of_find_n_match_cpu_property(cpun,
-   ibm,ppc-interrupt-server#s, cpu, thread))
-   return cpun;
-
-   if (__of_find_n_match_cpu_property(cpun, reg, cpu, thread))
-   return cpun;
-   }
-   return NULL;
-}
-EXPORT_SYMBOL(of_get_cpu_node);
-
 #if defined(CONFIG_DEBUG_FS)  defined(DEBUG)
 static struct debugfs_blob_wrapper flat_dt_blob;
 
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5c54279..d088e45 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -18,6 +18,7 @@
  *  2 of the License, or (at your option) any later version.
  */
 #include linux/ctype.h
+#include linux/cpu.h
 #include linux/module.h
 #include linux/of.h
 #include linux/spinlock.h
@@ -230,6 +231,99 @@ const void *of_get_property(const struct device_node *np, 
const char *name,
 }
 EXPORT_SYMBOL(of_get_property);
 
+/*
+ * arch_match_cpu_phys_id - Match the given logical CPU and physical id
+ *
+ * @cpu: logical index of a cpu
+ * @phys_id: physical identifier of a cpu
+ *
+ * CPU logical to physical index mapping is architecture specific.
+ * However this __weak function provides a default match of physical
+ * id to logical cpu index.
+ *
+ * Returns true if the physical identifier and the logical index correspond
+ * to the same cpu, false otherwise.
+ */
+bool __weak arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+   return (u32)phys_id == cpu;
+}
+
+/**
+ * Checks if the given 

[RFC PATCH 3/4] powerpc: refactor of_get_cpu_node to support other architectures

2013-08-15 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Currently different drivers requiring to access cpu device node are
parsing the device tree themselves. Since the ordering in the DT need
not match the logical cpu ordering, the parsing logic needs to consider
that. However, this has resulted in lots of code duplication and in some
cases even incorrect logic.

It's better to consolidate them by adding support for getting cpu
device node for a given logical cpu index in DT core library. However
logical to physical index mapping can be architecture specific.

PowerPC has it's own implementation to get the cpu node for a given
logical index.

This patch refactors the current implementation of of_get_cpu_node.
This in preparation to move the implementation to DT core library.
It separates out the logical to physical mapping so that a default
matching of the physical id to the logical cpu index can be added
when moved to common code. Architecture specific code can override it.

Cc: Rob Herring rob.herr...@calxeda.com
Cc: Grant Likely grant.lik...@linaro.org
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/powerpc/kernel/prom.c | 70 --
 1 file changed, 43 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index eb23ac9..594c9f9 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -865,45 +865,61 @@ static int __init prom_reconfig_setup(void)
 __initcall(prom_reconfig_setup);
 #endif
 
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+   return (int)phys_id == get_hard_smp_processor_id(cpu);
+}
+
+static bool __of_find_n_match_cpu_property(struct device_node *cpun,
+   const char *prop_name, int cpu, unsigned int *thread)
+{
+   const __be32 *cell;
+   int ac, prop_len, tid;
+   u64 hwid;
+
+   ac = of_n_addr_cells(cpun);
+   cell = of_get_property(cpun, prop_name, prop_len);
+   if (!cell)
+   return false;
+   prop_len /= sizeof(*cell);
+   for (tid = 0; tid  prop_len; tid++) {
+   hwid = of_read_number(cell, ac);
+   if (arch_match_cpu_phys_id(cpu, hwid)) {
+   if (thread)
+   *thread = tid;
+   return true;
+   }
+   }
+   return false;
+}
+
 /* Find the device node for a given logical cpu number, also returns the cpu
  * local thread number (index in ibm,interrupt-server#s) if relevant and
  * asked for (non NULL)
  */
 struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
 {
-   int hardid;
-   struct device_node *np;
+   struct device_node *cpun, *cpus;
 
-   hardid = get_hard_smp_processor_id(cpu);
+   cpus = of_find_node_by_path(/cpus);
+   if (!cpus) {
+   pr_warn(Missing cpus node, bailing out\n);
+   return NULL;
+   }
 
-   for_each_node_by_type(np, cpu) {
-   const u32 *intserv;
-   unsigned int plen, t;
+   for_each_child_of_node(cpus, cpun) {
+   if (of_node_cmp(cpun-type, cpu))
+   continue;
 
/* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
 * fallback to reg property and assume no threads
 */
-   intserv = of_get_property(np, ibm,ppc-interrupt-server#s,
-   plen);
-   if (intserv == NULL) {
-   const u32 *reg = of_get_property(np, reg, NULL);
-   if (reg == NULL)
-   continue;
-   if (*reg == hardid) {
-   if (thread)
-   *thread = 0;
-   return np;
-   }
-   } else {
-   plen /= sizeof(u32);
-   for (t = 0; t  plen; t++) {
-   if (hardid == intserv[t]) {
-   if (thread)
-   *thread = t;
-   return np;
-   }
-   }
-   }
+   if (__of_find_n_match_cpu_property(cpun,
+   ibm,ppc-interrupt-server#s, cpu, thread))
+   return cpun;
+
+   if (__of_find_n_match_cpu_property(cpun, reg, cpu, thread))
+   return cpun;
}
return NULL;
 }
-- 
1.8.1.2


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/3] cpufreq: pmac64: speed up frequency switch

2013-08-15 Thread Aaro Koskinen
Hi,

On Mon, Aug 12, 2013 at 11:07:48AM +1000, Benjamin Herrenschmidt wrote:
 On Wed, 2013-07-24 at 07:14 +1000, Benjamin Herrenschmidt wrote:
  On Tue, 2013-07-23 at 23:20 +0200, Rafael J. Wysocki wrote:
   All looks good in the patchset from 1 feet (or more), but I need
   Ben to speak here.
  
  I want to give it a quick spin on the HW here, I'll ack then. But yes,
  it looks good.
 
 Seems to work here on the quad G5.
 
 However, If I use on-demand, there's a huge latency of switch as far as
 I can tell (about 10s) after I start/stop a bunch of CPU eaters... I
 quite like how the userspace powernowd which I used to use switches
 more aggressively.
 
 Is that expected ?

I guess we should keep the current 12us latency in g5_neo2_cpufreq_init()
(although I doubt it's correct...), and only add the new 10ms latency
value to g5_pm72_cpufreq_init() - that way we can enable the older systems
to use ondemand (despite long latencies), while not risking regressing
any of the current functionality.

I'll resend the series with the changes.

A.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/3] cpufreq: pmac64: speed up frequency switch

2013-08-15 Thread Benjamin Herrenschmidt
On Thu, 2013-08-15 at 23:10 +0300, Aaro Koskinen wrote:

 I guess we should keep the current 12us latency in g5_neo2_cpufreq_init()
 (although I doubt it's correct...), and only add the new 10ms latency
 value to g5_pm72_cpufreq_init() - that way we can enable the older systems
 to use ondemand (despite long latencies), while not risking regressing
 any of the current functionality.
 
 I'll resend the series with the changes.

Well, mine is a 11,2, it's not a neo2.

I suppose we could try to measure the latency :-)

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v3 0/7] net: use platform_{get,set}_drvdata()

2013-08-15 Thread David Miller
From: Libo Chen clbchenlibo.c...@huawei.com
Date: Thu, 15 Aug 2013 21:01:17 +0800

 Use the wrapper functions for getting and setting the driver data using
 platform_device instead of using dev_{get,set}_drvdata() with pdev-dev,
 so we can directly pass a struct platform_device.
 
 changelog v3:
   remove modify about dev_set_drvdata()
 changelog v2:
   this version add modify record about dev_set_drvdata().

Series applied.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v3 0/7] net: use platform_{get,set}_drvdata()

2013-08-15 Thread David Miller
From: David Miller da...@davemloft.net
Date: Thu, 15 Aug 2013 15:23:59 -0700 (PDT)

 From: Libo Chen clbchenlibo.c...@huawei.com
 Date: Thu, 15 Aug 2013 21:01:17 +0800
 
 Use the wrapper functions for getting and setting the driver data using
 platform_device instead of using dev_{get,set}_drvdata() with pdev-dev,
 so we can directly pass a struct platform_device.
 
 changelog v3:
  remove modify about dev_set_drvdata()
 changelog v2:
  this version add modify record about dev_set_drvdata().
 
 Series applied.

Actually, I had to revert, these patches break the build.

drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_probe’:
drivers/net/ethernet/sun/sunhme.c:3114:2: error: implicit declaration of 
function ‘platform_set_drvdata’ [-Werror=implicit-function-declaration]
drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_remove’:
drivers/net/ethernet/sun/sunhme.c:3162:9: error: implicit declaration of 
function ‘platform_get_drvdata’ [-Werror=implicit-function-declaration]
drivers/net/ethernet/sun/sunhme.c:3162:26: warning: initialization makes 
pointer from integer without a cast [enabled by default]
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v3 0/7] net: use platform_{get,set}_drvdata()

2013-08-15 Thread Sergei Shtylyov

Hello.

On 08/16/2013 02:39 AM, David Miller wrote:


From: Libo Chen clbchenlibo.c...@huawei.com
Date: Thu, 15 Aug 2013 21:01:17 +0800



Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with pdev-dev,
so we can directly pass a struct platform_device.



changelog v3:
remove modify about dev_set_drvdata()
changelog v2:
this version add modify record about dev_set_drvdata().



Series applied.



Actually, I had to revert, these patches break the build.



drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_probe’:
drivers/net/ethernet/sun/sunhme.c:3114:2: error: implicit declaration of 
function ‘platform_set_drvdata’ [-Werror=implicit-function-declaration]
drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_remove’:
drivers/net/ethernet/sun/sunhme.c:3162:9: error: implicit declaration of 
function ‘platform_get_drvdata’ [-Werror=implicit-function-declaration]
drivers/net/ethernet/sun/sunhme.c:3162:26: warning: initialization makes 
pointer from integer without a cast [enabled by default]


   Hm, patch #5 was clearly defective as it tried to call 
platform_{get|set}_drvdata() on PCI devices -- I've read the patch but 
overlooked that. And the driver lacks #include linux/platform_device.h, so 
I'm not sure it always compiled flawlessly.


WBR, Sergei

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v3 0/7] net: use platform_{get,set}_drvdata()

2013-08-15 Thread Sergei Shtylyov

On 08/16/2013 02:51 AM, Sergei Shtylyov wrote:


From: Libo Chen clbchenlibo.c...@huawei.com
Date: Thu, 15 Aug 2013 21:01:17 +0800



Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with pdev-dev,
so we can directly pass a struct platform_device.



changelog v3:
remove modify about dev_set_drvdata()
changelog v2:
this version add modify record about dev_set_drvdata().



Series applied.



Actually, I had to revert, these patches break the build.



drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_probe’:
drivers/net/ethernet/sun/sunhme.c:3114:2: error: implicit declaration of
function ‘platform_set_drvdata’ [-Werror=implicit-function-declaration]
drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_remove’:
drivers/net/ethernet/sun/sunhme.c:3162:9: error: implicit declaration of
function ‘platform_get_drvdata’ [-Werror=implicit-function-declaration]
drivers/net/ethernet/sun/sunhme.c:3162:26: warning: initialization makes
pointer from integer without a cast [enabled by default]



Hm, patch #5 was clearly defective as it tried to call
platform_{get|set}_drvdata() on PCI devices -- I've read the patch but
overlooked that. And the driver lacks #include linux/platform_device.h, so
I'm not sure it always compiled flawlessly.


   Ah, the platform code is protected by #ifdef CONFIG_SBUS... probably some 
header #include's linux/platform_device.h?


WBR, Sergei

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] powerpc/wsp: Fix early debug build

2013-08-15 Thread Benjamin Herrenschmidt
When reworking udbg_16550.c I forgot to remove the old and now useless
code for the CONFIG_PPC_EARLY_DEBUG_WSP case, which doesn't build as
a result. I also missed a cast.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---

diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 25c58e8..75702e2 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -300,45 +300,9 @@ void __init udbg_init_40x_realmode(void)
 
 #ifdef CONFIG_PPC_EARLY_DEBUG_WSP
 
-static void udbg_wsp_flush(void)
-{
-   if (udbg_comport) {
-   while ((readb(udbg_comport-lsr)  LSR_THRE) == 0)
-   /* wait for idle */;
-   }
-}
-
-static void udbg_wsp_putc(char c)
-{
-   if (udbg_comport) {
-   if (c == '\n')
-   udbg_wsp_putc('\r');
-   udbg_wsp_flush();
-   writeb(c, udbg_comport-thr); eieio();
-   }
-}
-
-static int udbg_wsp_getc(void)
-{
-   if (udbg_comport) {
-   while ((readb(udbg_comport-lsr)  LSR_DR) == 0)
-   ; /* wait for char */
-   return readb(udbg_comport-rbr);
-   }
-   return -1;
-}
-
-static int udbg_wsp_getc_poll(void)
-{
-   if (udbg_comport)
-   if (readb(udbg_comport-lsr)  LSR_DR)
-   return readb(udbg_comport-rbr);
-   return -1;
-}
-
 void __init udbg_init_wsp(void)
 {
-   udbg_uart_init_mmio(WSP_UART_VIRT, 1);
+   udbg_uart_init_mmio((void *)WSP_UART_VIRT, 1);
udbg_uart_setup(57600, 5000);
 }
 


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc/powernv: Return secondary CPUs to firmware on kexec

2013-08-15 Thread Michael Neuling
 With OPAL v3 we can return secondary CPUs to firmware on kexec. This
 allows firmware to do various cleanups making things generally more
 reliable, and will enable the new kernel to call OPAL to perform
 some reconfiguration tasks early on that can only be done while
 all the CPUs are in firmware.

Dumb question, but isn't the point of kexec to avoid fw interactions like
this?

Mikey

 Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org

 diff --git a/arch/powerpc/platforms/powernv/setup.c
b/arch/powerpc/platforms/powernv/setup.c
 index d4459bf..b59a1da 100644
 --- a/arch/powerpc/platforms/powernv/setup.c
 +++ b/arch/powerpc/platforms/powernv/setup.c
 @@ -31,6 +31,7 @@
  #include asm/xics.h
  #include asm/rtas.h
  #include asm/opal.h
 +#include asm/kexec.h

  #include powernv.h

 @@ -143,6 +144,16 @@ static void pnv_shutdown(void)
  static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
  {
 xics_kexec_teardown_cpu(secondary);
 +
 +   /* Return secondary CPUs to firmware on OPAL v3 */
 +   if (firmware_has_feature(FW_FEATURE_OPALv3)  secondary) {
 +   mb();
 +   get_paca()-kexec_state = KEXEC_STATE_REAL_MODE;
 +   mb();
 +
 +   /* Return the CPU to OPAL */
 +   opal_return_cpu();
 +   }
  }
  #endif /* CONFIG_KEXEC */



 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/linuxppc-dev

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v3 0/7] net: use platform_{get,set}_drvdata()

2013-08-15 Thread Libo Chen
On 2013/8/16 6:39, David Miller wrote:
 From: David Miller da...@davemloft.net
 Date: Thu, 15 Aug 2013 15:23:59 -0700 (PDT)
 
 From: Libo Chen clbchenlibo.c...@huawei.com
 Date: Thu, 15 Aug 2013 21:01:17 +0800

 Use the wrapper functions for getting and setting the driver data using
 platform_device instead of using dev_{get,set}_drvdata() with pdev-dev,
 so we can directly pass a struct platform_device.

 changelog v3:
 remove modify about dev_set_drvdata()
 changelog v2:
 this version add modify record about dev_set_drvdata().

 Series applied.
 
 Actually, I had to revert, these patches break the build.
 
 drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_probe’:
 drivers/net/ethernet/sun/sunhme.c:3114:2: error: implicit declaration of 
 function ‘platform_set_drvdata’ [-Werror=implicit-function-declaration]
 drivers/net/ethernet/sun/sunhme.c: In function ‘happy_meal_pci_remove’:
 drivers/net/ethernet/sun/sunhme.c:3162:9: error: implicit declaration of 
 function ‘platform_get_drvdata’ [-Werror=implicit-function-declaration]
 drivers/net/ethernet/sun/sunhme.c:3162:26: warning: initialization makes 
 pointer from integer without a cast [enabled by default]
 


oh, it is my fault, I will update!

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] powerpc/powernv: Return secondary CPUs to firmware on kexec

2013-08-15 Thread Benjamin Herrenschmidt
On Fri, 2013-08-16 at 11:16 +1000, Michael Neuling wrote:
 
  With OPAL v3 we can return secondary CPUs to firmware on kexec. This
  allows firmware to do various cleanups making things generally more
  reliable, and will enable the new kernel to call OPAL to perform
  some reconfiguration tasks early on that can only be done while
  all the CPUs are in firmware.
 
 Dumb question, but isn't the point of kexec to avoid fw interactions
 like this?

The point of kexec is to avoid rebooting :-)

Sending secondaries back to the OPAL internal spin loop doesn't take a
noticeable amount of time.

We could avoid doing it and solve the problem of needing all CPUs in
firmware for reconfig differently however. We could have the target
kernel code take them out of kexec into a special path that goes back
into the fw ... I chose the kexec solution because it was simpler and
less code :-)

Cheers,
Ben.

 Mikey
 
 
  Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
 
  diff --git a/arch/powerpc/platforms/powernv/setup.c
 b/arch/powerpc/platforms/powernv/setup.c
  index d4459bf..b59a1da 100644
  --- a/arch/powerpc/platforms/powernv/setup.c
  +++ b/arch/powerpc/platforms/powernv/setup.c
  @@ -31,6 +31,7 @@
   #include asm/xics.h
   #include asm/rtas.h
   #include asm/opal.h
  +#include asm/kexec.h
 
   #include powernv.h
 
  @@ -143,6 +144,16 @@ static void pnv_shutdown(void)
   static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
   {
  xics_kexec_teardown_cpu(secondary);
  +
  +   /* Return secondary CPUs to firmware on OPAL v3 */
  +   if (firmware_has_feature(FW_FEATURE_OPALv3)  secondary) {
  +   mb();
  +   get_paca()-kexec_state = KEXEC_STATE_REAL_MODE;
  +   mb();
  +
  +   /* Return the CPU to OPAL */
  +   opal_return_cpu();
  +   }
   }
   #endif /* CONFIG_KEXEC */
 
 
 
  ___
  Linuxppc-dev mailing list
  Linuxppc-dev@lists.ozlabs.org
  https://lists.ozlabs.org/listinfo/linuxppc-dev
 
 
 


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v5 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver

2013-08-15 Thread Nicolin Chen
Hi Tomasz,
   
   Thank you for the comments. I'll revise them in v6.
   And below is my reply for you comments.

On Thu, Aug 15, 2013 at 02:18:22PM +0200, Tomasz Figa wrote:
  +  - clock-names : Includes the following entries:
  +   nametypecomments
  +   core  RequiredThe core clock of spdif controller
  +
  +   rxOptionalRx clock source for spdif record.
  +   If absent, will use core clock.
  +
  +   txOptionalTx clock source for spdif playback.
  +   If absent, will use core clock.
  +
  +   tx-32000  OptionalTx clock source for 32000Hz sample rate
  +   playback. If absent, will use tx clock.
  +
  +   tx-44100  OptionalTx clock source for 44100Hz sample rate
  +   playback. If absent, will use tx clock.
  +
  +   tx-48000  OptionalTx clock source for 48000Hz sample rate
  +   playback. If absent, will use tx clock.
  +
  +   src0-7  OptionalClock source list for tx and rx clock
  +   to look up their clock source indexes.
  +   This clock list should be identical to
  +   the list of TxClk_Source bit value of
  +   register SPDIF_STC. If absent or failed
  +   to look up, tx and rx clock would then
  +   ignore the rx, tx tx-32000,
  +   tx-44100, tx-48000 clock phandles
  +   and select the core clock as default
  +   tx and rx clock.
 
 I suspect a little abuse of clocks property here. From the description of
 core and src0-7 clocks I assume that the IP can have up to 9 clock
 inputs - core clock and up to 8 extra source clocks. Is it correct?
 
 If yes, this makes the tx, rx and tx-* clocks describe
 configuration, not hardware. IMHO it should be up to the driver which
 source clocks to use for tx and rx channels and for each sampling rate.

First, you are right that all the properties you just commented are
software configurations. And I got the point that device tree now
can't allow any software configuration even if the actual hardware
connection will depend on it.

If so, I would like to remove those abused clocks and also drop the 
unused clocks in src0-7, then just remain those needed clocks src.
I think that can be plausible because there'll be no more clock abuse
and the driver will be able to get the source index from the name 
'srcnum'.

And you are right about the 9 clock inputs, just there're not only 9
inputs but also an extra external clock from S/PDIF transmitter via
coaxial cable or optical fiber -- RxCLK. Please check the following
list:

 if (DPLL Locked) SPDIF_RxClk else extal
0001 if (DPLL Locked) SPDIF_RxClk else spdif_clk
0010 if (DPLL Locked) SPDIF_RxClk else asrc_clk
0011 if (DPLL Locked) SPDIF_RxClk else spdif_extclk
0100 if (DPLL Locked) SPDIF_Rxclk else esai_hckt
0101 extal_clk
0110 spdif_clk
0111 asrc_clk
1000 spdif_extclk
1001 esai_hckt
1010 if (DPLL Locked) SPDIF_RxClk else mlb_clk
1011 if (DPLL Locked) SPDIF_RxClk else mlb_phy_clk
1100 mkb_clk
1101 mlb_phy_clk

When (DPLL Locked) condition matches, the rx clock can ignore the 8 input
clocks from clock mux then use the external one from a S/PDIF transmitter.

So for the below part:

  +Optional properties:
  +
  +  - rx-clksrc-lock: This is a boolean property. If present, ClkSrc_Sel
  bit +  of SPDIF_SRPC would be set a clock source that cares DPLL locked
  condition. +
 
 This again looks like software configuration, not hardware description.
 Could you elaborate a bit more on meaning of this property?

I think the rx-clksrc-lock property should be included in DT as well, since
it's exactly a available clock source for rx. But I guess I just need to 
figure out a better way or a more elaborated description.

Thank you,
Nicolin Chen



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFC PATCH 3/4] powerpc: refactor of_get_cpu_node to support other architectures

2013-08-15 Thread Benjamin Herrenschmidt
On Thu, 2013-08-15 at 18:09 +0100, Sudeep KarkadaNagesha wrote:
/* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
  * fallback to reg property and assume no threads
  */
 -

Oh and I forgot ... that comment is now wrong, since your code handles
threads in the reg case...

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFC PATCH 3/4] powerpc: refactor of_get_cpu_node to support other architectures

2013-08-15 Thread Benjamin Herrenschmidt
On Thu, 2013-08-15 at 18:09 +0100, Sudeep KarkadaNagesha wrote:
 From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
 
 Currently different drivers requiring to access cpu device node are
 parsing the device tree themselves. Since the ordering in the DT need
 not match the logical cpu ordering, the parsing logic needs to consider
 that. However, this has resulted in lots of code duplication and in some
 cases even incorrect logic.

 .../...

  
 +bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 +{
 + return (int)phys_id == get_hard_smp_processor_id(cpu);
 +}

Naming is a bit gross. You might want to make it clearer that
we are talking about CPU IDs in the device-tree here.

 +static bool __of_find_n_match_cpu_property(struct device_node *cpun,
 + const char *prop_name, int cpu, unsigned int *thread)
 +{
 + const __be32 *cell;
 + int ac, prop_len, tid;
 + u64 hwid;
 +
 + ac = of_n_addr_cells(cpun);
 + cell = of_get_property(cpun, prop_name, prop_len);
 + if (!cell)
 + return false;
 + prop_len /= sizeof(*cell);
 + for (tid = 0; tid  prop_len; tid++) {
 + hwid = of_read_number(cell, ac);
 + if (arch_match_cpu_phys_id(cpu, hwid)) {
 + if (thread)
 + *thread = tid;
 + return true;
 + }

Missing:  cell += ac;

 + }
 + return false;
 +}
 +
  /* Find the device node for a given logical cpu number, also returns the cpu
   * local thread number (index in ibm,interrupt-server#s) if relevant and
   * asked for (non NULL)
   */
  struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
  {
 - int hardid;
 - struct device_node *np;
 + struct device_node *cpun, *cpus;
  
 - hardid = get_hard_smp_processor_id(cpu);
 + cpus = of_find_node_by_path(/cpus);
 + if (!cpus) {
 + pr_warn(Missing cpus node, bailing out\n);
 + return NULL;
 + }
  
 - for_each_node_by_type(np, cpu) {
 - const u32 *intserv;
 - unsigned int plen, t;
 + for_each_child_of_node(cpus, cpun) {
 + if (of_node_cmp(cpun-type, cpu))
 + continue;
  
   /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
* fallback to reg property and assume no threads
*/
 - intserv = of_get_property(np, ibm,ppc-interrupt-server#s,
 - plen);
 - if (intserv == NULL) {
 - const u32 *reg = of_get_property(np, reg, NULL);
 - if (reg == NULL)
 - continue;
 - if (*reg == hardid) {
 - if (thread)
 - *thread = 0;
 - return np;
 - }
 - } else {
 - plen /= sizeof(u32);
 - for (t = 0; t  plen; t++) {
 - if (hardid == intserv[t]) {
 - if (thread)
 - *thread = t;
 - return np;
 - }
 - }
 - }
 + if (__of_find_n_match_cpu_property(cpun,
 + ibm,ppc-interrupt-server#s, cpu, thread))
 + return cpun;
 +
 + if (__of_find_n_match_cpu_property(cpun, reg, cpu, thread))
 + return cpun;
   }
   return NULL;
  }

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 6/6 v4] kvm: powerpc: use caching attributes as per linux pte

2013-08-15 Thread Bharat Bhushan
KVM uses same WIM tlb attributes as the corresponding qemu pte.
For this we now search the linux pte for the requested page and
get these cache caching/coherency attributes from pte.

Signed-off-by: Bharat Bhushan bharat.bhus...@freescale.com
---
v3-v4
 - s/printk/printk_ratelimited till we return machine check in mmu setup

v2-v3
 - setting pgdir before kvmppc_fix_ee_before_entry() on vcpu_run
 - Aligned as per changes in patch 5/6
 - setting WIMG for pfnmap pages also
 
v1-v2
 - Use Linux pte for wimge rather than RAM/no-RAM mechanism

 arch/powerpc/include/asm/kvm_host.h |2 +-
 arch/powerpc/kvm/booke.c|2 +-
 arch/powerpc/kvm/e500.h |8 --
 arch/powerpc/kvm/e500_mmu_host.c|   38 --
 4 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h 
b/arch/powerpc/include/asm/kvm_host.h
index 3328353..583d405 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -535,6 +535,7 @@ struct kvm_vcpu_arch {
 #endif
gpa_t paddr_accessed;
gva_t vaddr_accessed;
+   pgd_t *pgdir;
 
u8 io_gpr; /* GPR used as IO source/target */
u8 mmio_is_bigendian;
@@ -592,7 +593,6 @@ struct kvm_vcpu_arch {
struct list_head run_list;
struct task_struct *run_task;
struct kvm_run *kvm_run;
-   pgd_t *pgdir;
 
spinlock_t vpa_update_lock;
struct kvmppc_vpa vpa;
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 17722d8..0d96d50 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -696,8 +696,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct 
kvm_vcpu *vcpu)
kvmppc_load_guest_fp(vcpu);
 #endif
 
+   vcpu-arch.pgdir = current-mm-pgd;
kvmppc_fix_ee_before_entry();
-
ret = __kvmppc_vcpu_run(kvm_run, vcpu);
 
/* No need for kvm_guest_exit. It's done in handle_exit.
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index 4fd9650..fc4b2f6 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -31,11 +31,13 @@ enum vcpu_ftr {
 #define E500_TLB_NUM   2
 
 /* entry is mapped somewhere in host TLB */
-#define E500_TLB_VALID (1  0)
+#define E500_TLB_VALID (1  31)
 /* TLB1 entry is mapped by host TLB1, tracked by bitmaps */
-#define E500_TLB_BITMAP(1  1)
+#define E500_TLB_BITMAP(1  30)
 /* TLB1 entry is mapped by host TLB0 */
-#define E500_TLB_TLB0  (1  2)
+#define E500_TLB_TLB0  (1  29)
+/* Lower 5 bits have WIMGE value */
+#define E500_TLB_WIMGE_MASK(0x1f)
 
 struct tlbe_ref {
pfn_t pfn;  /* valid only for TLB0, except briefly */
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 1c6a9d7..603f5ba 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -64,15 +64,6 @@ static inline u32 e500_shadow_mas3_attrib(u32 mas3, int 
usermode)
return mas3;
 }
 
-static inline u32 e500_shadow_mas2_attrib(u32 mas2, int usermode)
-{
-#ifdef CONFIG_SMP
-   return (mas2  MAS2_ATTRIB_MASK) | MAS2_M;
-#else
-   return mas2  MAS2_ATTRIB_MASK;
-#endif
-}
-
 /*
  * writing shadow tlb entry to host TLB
  */
@@ -248,10 +239,12 @@ static inline int tlbe_is_writable(struct 
kvm_book3e_206_tlb_entry *tlbe)
 
 static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
 struct kvm_book3e_206_tlb_entry *gtlbe,
-pfn_t pfn)
+pfn_t pfn, int wimg)
 {
ref-pfn = pfn;
ref-flags |= E500_TLB_VALID;
+   /* Use guest supplied MAS2_G and MAS2_E */
+   ref-flags |= (gtlbe-mas2  MAS2_ATTRIB_MASK) | wimg;
 
if (tlbe_is_writable(gtlbe))
kvm_set_pfn_dirty(pfn);
@@ -312,8 +305,7 @@ static void kvmppc_e500_setup_stlbe(
 
/* Force IPROT=0 for all guest mappings. */
stlbe-mas1 = MAS1_TSIZE(tsize) | get_tlb_sts(gtlbe) | MAS1_VALID;
-   stlbe-mas2 = (gvaddr  MAS2_EPN) |
- e500_shadow_mas2_attrib(gtlbe-mas2, pr);
+   stlbe-mas2 = (gvaddr  MAS2_EPN) | (ref-flags  E500_TLB_WIMGE_MASK);
stlbe-mas7_3 = ((u64)pfn  PAGE_SHIFT) |
e500_shadow_mas3_attrib(gtlbe-mas7_3, pr);
 
@@ -332,6 +324,10 @@ static inline int kvmppc_e500_shadow_map(struct 
kvmppc_vcpu_e500 *vcpu_e500,
unsigned long hva;
int pfnmap = 0;
int tsize = BOOK3E_PAGESZ_4K;
+   unsigned long tsize_pages = 0;
+   pte_t *ptep;
+   int wimg = 0;
+   pgd_t *pgdir;
 
/*
 * Translate guest physical to true physical, acquiring
@@ -394,7 +390,7 @@ static inline int kvmppc_e500_shadow_map(struct 
kvmppc_vcpu_e500 *vcpu_e500,
 */
 
for (; tsize  BOOK3E_PAGESZ_4K; tsize -= 2) {
- 

Critical Interrupt Input

2013-08-15 Thread Henry Bausley

Is there any reason that a Critical Input Interrupt will not work reliably 
on a 44x powerpc?

I am using an AMCC now Applied Micro AMCC460EX 

and changed

CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception)
to
CRITICAL_EXCEPTION(0x0100, CriticalInput, do_MyCritIntr)

The code for the handler is trivial
ie.
int crintrcount;

void do_MyCritIntr(void)
{
  crintrcount++;
}

The code runs for a while but eventually I get panic messages and  the 
system hangs.  Is there something I must alter in the kernel to do this 
reliably?



Outbound scan for Spam or Virus by Barracuda at Delta Tau

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev