qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] arm: Fix CP15 FSR (C5) domain setting
@ 2011-11-04 20:50 Jean-Christophe DUBOIS
  2011-11-04 21:07 ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
  2011-11-08 10:44 ` [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe DUBOIS @ 2011-11-04 20:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, paul

During Xvisor development, it was noted that qemu did not return
the correct domain value in the Cp15 [Data] FSR register (C5).

This patch is a proposal to fix it.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
---

--- qemu-0.15.1.org/target-arm/helper.c    2011-10-12 18:41:43.000000000 
+0200
+++ qemu-0.15.1/target-arm/helper.c    2011-11-04 00:49:03.247062518 +0100
@@ -924,12 +924,12 @@
  /* Check section/page access permissions.
     Returns the page protection flags, or zero if the access is not
     permitted.  */
-static inline int check_ap(CPUState *env, int ap, int domain, int 
access_type,
+static inline int check_ap(CPUState *env, int ap, int domain_prot, int 
access_type,
                             int is_user)
  {
    int prot_ro;

-  if (domain == 3)
+  if (domain_prot == 3)
      return PAGE_READ | PAGE_WRITE;

    if (access_type == 1)
@@ -996,6 +996,7 @@
      int type;
      int ap;
      int domain;
+    int domain_prot;
      uint32_t phys_addr;

      /* Pagetable walk.  */
@@ -1003,13 +1004,14 @@
      table = get_level1_table_address(env, address);
      desc = ldl_phys(table);
      type = (desc & 3);
-    domain = (env->cp15.c3 >> ((desc >> 4) & 0x1e)) & 3;
+    domain = (desc >> 5) & 0x0f;
+    domain_prot = (env->cp15.c3 >> (domain * 2)) & 3;
      if (type == 0) {
          /* Section translation fault.  */
          code = 5;
          goto do_fault;
      }
-    if (domain == 0 || domain == 2) {
+    if (domain_prot == 0 || domain_prot == 2) {
          if (type == 2)
              code = 9; /* Section domain fault.  */
          else
@@ -1067,7 +1069,7 @@
          }
          code = 15;
      }
-    *prot = check_ap(env, ap, domain, access_type, is_user);
+    *prot = check_ap(env, ap, domain_prot, access_type, is_user);
      if (!*prot) {
          /* Access permission fault.  */
          goto do_fault;
@@ -1090,6 +1092,7 @@
      int type;
      int ap;
      int domain;
+    int domain_prot;
      uint32_t phys_addr;

      /* Pagetable walk.  */
@@ -1107,10 +1110,10 @@
          domain = 0;
      } else {
          /* Section or page.  */
-        domain = (desc >> 4) & 0x1e;
+        domain = (desc >> 5) & 0x0f;
      }
-    domain = (env->cp15.c3 >> domain) & 3;
-    if (domain == 0 || domain == 2) {
+    domain_prot = (env->cp15.c3 >> (domain * 2)) & 3;
+    if (domain_prot == 0 || domain_prot == 2) {
          if (type == 2)
              code = 9; /* Section domain fault.  */
          else
@@ -1155,7 +1158,7 @@
          }
          code = 15;
      }
-    if (domain == 3) {
+    if (domain_prot == 3) {
          *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
      } else {
          if (xn && access_type == 2)
@@ -1167,7 +1170,7 @@
              code = (code == 15) ? 6 : 3;
              goto do_fault;
          }
-        *prot = check_ap(env, ap, domain, access_type, is_user);
+        *prot = check_ap(env, ap, domain_prot, access_type, is_user);
          if (!*prot) {
              /* Access permission fault.  */
              goto do_fault;



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] arm: Fix CP15 FSR (C5) domain setting
  2011-11-04 20:50 [Qemu-trivial] [PATCH] arm: Fix CP15 FSR (C5) domain setting Jean-Christophe DUBOIS
@ 2011-11-04 21:07 ` Peter Maydell
  2011-11-08 10:44 ` [Qemu-trivial] " Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-11-04 21:07 UTC (permalink / raw)
  To: Jean-Christophe DUBOIS; +Cc: qemu-trivial, qemu-devel, paul

On 4 November 2011 20:50, Jean-Christophe DUBOIS <jcd@tribudubois.net> wrote:
> During Xvisor development, it was noted that qemu did not return
> the correct domain value in the Cp15 [Data] FSR register (C5).
>
> This patch is a proposal to fix it.

> --- qemu-0.15.1.org/target-arm/helper.c    2011-10-12 18:41:43.000000000
> +0200
> +++ qemu-0.15.1/target-arm/helper.c    2011-11-04 00:49:03.247062518 +0100
> @@ -924,12 +924,12 @@

This is on my todo list to review. In the meantime:
 * you should submit patches against current qemu git master,
   not an old released version, please
 * if you can send emails via a path that doesn't line wrap long
   lines this makes life much easier on the receiving end
 * this is definitely not a trivial patch
 * it's worth running patches through ./scripts/checkpatch.pl
   to catch minor coding style issues
 * if you resend a patch please include a note about what has
   changed since the previous version and put a 'v2/v3/...'
   note in the email subject.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-trivial] [PATCH] arm: Fix CP15 FSR (C5) domain setting
  2011-11-04 20:50 [Qemu-trivial] [PATCH] arm: Fix CP15 FSR (C5) domain setting Jean-Christophe DUBOIS
  2011-11-04 21:07 ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
@ 2011-11-08 10:44 ` Stefan Hajnoczi
  2011-11-08 12:18   ` Peter Maydell
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2011-11-08 10:44 UTC (permalink / raw)
  To: Jean-Christophe DUBOIS; +Cc: qemu-trivial, peter.maydell, qemu-devel, paul

On Fri, Nov 04, 2011 at 09:50:25PM +0100, Jean-Christophe DUBOIS wrote:
> During Xvisor development, it was noted that qemu did not return
> the correct domain value in the Cp15 [Data] FSR register (C5).
> 
> This patch is a proposal to fix it.
> 
> Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
> ---

CCed Peter Maydell so this can go through the ARM tree.

Stefan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-trivial] [PATCH] arm: Fix CP15 FSR (C5) domain setting
  2011-11-08 10:44 ` [Qemu-trivial] " Stefan Hajnoczi
@ 2011-11-08 12:18   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-11-08 12:18 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, paul, qemu-devel, Jean-Christophe DUBOIS

On 8 November 2011 10:44, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Fri, Nov 04, 2011 at 09:50:25PM +0100, Jean-Christophe DUBOIS wrote:
>> During Xvisor development, it was noted that qemu did not return
>> the correct domain value in the Cp15 [Data] FSR register (C5).
>>
>> This patch is a proposal to fix it.
>>
>> Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
>> ---
>
> CCed Peter Maydell so this can go through the ARM tree.

This is an old and broken version of a patch which I've already
reviewed the fixed version of -- you can ignore this one.

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-08 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 20:50 [Qemu-trivial] [PATCH] arm: Fix CP15 FSR (C5) domain setting Jean-Christophe DUBOIS
2011-11-04 21:07 ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
2011-11-08 10:44 ` [Qemu-trivial] " Stefan Hajnoczi
2011-11-08 12:18   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).