All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas@tklengyel.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Petre Ovidiu PIRCALABU <ppircalabu@bitdefender.com>,
	"sstabellini@kernel.org" <sstabellini@kernel.org>,
	"julien@xen.org" <julien@xen.org>, "wl@xen.org" <wl@xen.org>,
	Razvan COJOCARU <rcojocaru@bitdefender.com>,
	"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	"george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
	Alexandru Stefan ISAILA <aisaila@bitdefender.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH V2 2/2] x86/mm: Make use of the default access param from xc_altp2m_create_view
Date: Tue, 19 Nov 2019 12:31:25 -0700	[thread overview]
Message-ID: <CABfawhmwTHsAhTyVSB5Tt83bNk7xjXDvrEWuo2MQarqm910LWA@mail.gmail.com> (raw)
In-Reply-To: <912e2d21-4fcc-a290-c4d5-d75d542fb192@suse.com>

On Mon, Nov 18, 2019 at 2:53 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 18.11.2019 09:38, Alexandru Stefan ISAILA wrote:
> > On 12.11.2019 14:02, Jan Beulich wrote:
> >> On 06.11.2019 16:35, Alexandru Stefan ISAILA wrote:
> >>> @@ -2572,17 +2574,36 @@ int p2m_init_altp2m_by_id(struct domain *d, unsigned int idx)
> >>>       altp2m_list_lock(d);
> >>>
> >>>       if ( d->arch.altp2m_eptp[idx] == mfn_x(INVALID_MFN) )
> >>> -        rc = p2m_activate_altp2m(d, idx);
> >>> +        rc = p2m_activate_altp2m(d, idx, hostp2m->default_access);
> >>>
> >>>       altp2m_list_unlock(d);
> >>>       return rc;
> >>>   }
> >>>
> >>> -int p2m_init_next_altp2m(struct domain *d, uint16_t *idx)
> >>> +int p2m_init_next_altp2m(struct domain *d, uint16_t *idx,
> >>> +                         uint16_t hvmmem_default_access)
> >>>   {
> >>>       int rc = -EINVAL;
> >>>       unsigned int i;
> >>>
> >>> +    static const p2m_access_t memaccess[] = {
> >>> +#define ACCESS(ac) [XENMEM_access_##ac] = p2m_access_##ac
> >>> +        ACCESS(n),
> >>> +        ACCESS(r),
> >>> +        ACCESS(w),
> >>> +        ACCESS(rw),
> >>> +        ACCESS(x),
> >>> +        ACCESS(rx),
> >>> +        ACCESS(wx),
> >>> +        ACCESS(rwx),
> >>> +        ACCESS(rx2rw),
> >>> +        ACCESS(n2rwx),
> >>> +#undef ACCESS
> >>> +    };
> >>> +
> >>> +    if ( hvmmem_default_access > XENMEM_access_default )
> >>> +        return rc;
> >>> +
> >>>       altp2m_list_lock(d);
> >>>
> >>>       for ( i = 0; i < MAX_ALTP2M; i++ )
> >>> @@ -2590,7 +2611,7 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t *idx)
> >>>           if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) )
> >>>               continue;
> >>>
> >>> -        rc = p2m_activate_altp2m(d, i);
> >>> +        rc = p2m_activate_altp2m(d, i, memaccess[hvmmem_default_access]);
> >>
> >> Aren't you open-coding xenmem_access_to_p2m_access() here? In
> >> no event should there be two instances of the same static array.
> >
> > I did this because xenmem_access_to_p2m_access() is defined static in
> > x86/mm/mem_access.c. If it's ok to have it defined in mem_access.h then
> > I can go with that and drop this part of the code.
>
> I see no reason why this wouldn't be a reasonable step, allowing to
> avoid code duplication. Looks like the function is even suitably
> named already for making non-static.

Sounds fine to me too.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-11-19 19:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 15:35 [Xen-devel] [PATCH V2 1/2] x86/altp2m: Add hypercall to set a range of sve bits Alexandru Stefan ISAILA
2019-11-06 15:35 ` [Xen-devel] [PATCH V2 2/2] x86/mm: Make use of the default access param from xc_altp2m_create_view Alexandru Stefan ISAILA
2019-11-12 12:02   ` Jan Beulich
2019-11-18  8:38     ` Alexandru Stefan ISAILA
2019-11-18  9:53       ` Jan Beulich
2019-11-19 19:31         ` Tamas K Lengyel [this message]
2019-11-06 21:06 ` [Xen-devel] [PATCH V2 1/2] x86/altp2m: Add hypercall to set a range of sve bits Tamas K Lengyel
2019-11-07  7:46   ` Alexandru Stefan ISAILA
2019-11-07 15:00     ` Tamas K Lengyel
2019-11-08  8:31 ` Alexandru Stefan ISAILA
2019-11-12 11:54 ` Jan Beulich
2019-11-12 14:05   ` Tamas K Lengyel
2019-11-12 14:31     ` Jan Beulich
2019-11-13 14:51       ` Tamas K Lengyel
2019-11-13 14:57         ` Tamas K Lengyel
2019-11-13 16:52           ` Jan Beulich
2019-11-13 18:38             ` Tamas K Lengyel
2019-11-18 13:39   ` Alexandru Stefan ISAILA
2019-11-18 13:39   ` Alexandru Stefan ISAILA
2019-11-18 14:09     ` Jan Beulich
2019-11-19  9:05       ` Alexandru Stefan ISAILA
2019-11-19  9:23         ` Jan Beulich
2019-11-20  8:29           ` Alexandru Stefan ISAILA
2019-11-20  8:41             ` Jan Beulich
2019-11-20  8:48               ` Alexandru Stefan ISAILA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABfawhmwTHsAhTyVSB5Tt83bNk7xjXDvrEWuo2MQarqm910LWA@mail.gmail.com \
    --to=tamas@tklengyel.com \
    --cc=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=ppircalabu@bitdefender.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.