All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Demi Marie Obenour <demi@invisiblethingslab.com>
Cc: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"Jun Nakajima" <jun.nakajima@intel.com>,
	"Kevin Tian" <kevin.tian@intel.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Tim Deegan" <tim@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 06/14] x86: Add memory type constants
Date: Wed, 14 Dec 2022 12:22:50 +0100	[thread overview]
Message-ID: <1ecbb51a-02d5-1ee4-d484-0a16c52d2493@suse.com> (raw)
In-Reply-To: <d01afab33bcf551f96f5650c37c51a567c43ad4d.1670948141.git.demi@invisiblethingslab.com>

On 13.12.2022 23:26, Demi Marie Obenour wrote:
> --- a/xen/arch/x86/include/asm/x86-defns.h
> +++ b/xen/arch/x86/include/asm/x86-defns.h
> @@ -153,4 +153,17 @@
>       (1u << X86_EXC_AC) | (1u << X86_EXC_CP) |                      \
>       (1u << X86_EXC_VC) | (1u << X86_EXC_SX))
>  
> +/* Memory types */
> +#define X86_MT_UC  _AC(0x00, ULL) /* uncachable */
> +#define X86_MT_WC  _AC(0x01, ULL) /* write-combined */
> +#define X86_MT_WT  _AC(0x04, ULL) /* write-through */
> +#define X86_MT_WP  _AC(0x05, ULL) /* write-protect */
> +#define X86_MT_WB  _AC(0x06, ULL) /* write-back */
> +#define X86_MT_UCM _AC(0x07, ULL) /* UC- */

I'm guessing that you use ULL here to simplify arithmetic when constructing
PAT MSR values, but did you also check that this doesn't lead to compilers
needlessly doing calculations in 64 bits when 32-bit (or yet more narrow)
operation would suffice?

> +#define X86_NUM_MT _AC(0x08, ULL)

This pretty certainly doesn't need ULL, and no use of _AC() at all.

> +/* Reserved memory types (cannot be used) */
> +#define X86_MT_RESERVED_1 _AC(0x02, ULL)
> +#define X86_MT_RESERVED_2 _AC(0x03, ULL)

I think it would be better if the left hand numbers matched the right hand
ones here.

Jan


  reply	other threads:[~2022-12-14 11:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 22:26 [PATCH v2 00/14] Make PAT handling less brittle Demi Marie Obenour
2022-12-13 22:26 ` [PATCH v2 01/14] x86/mm: Avoid hard-coding PAT in get_page_from_l1e() Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 02/14] p2m-pt: Avoid hard-coding Xen's PAT Demi Marie Obenour
2022-12-14 11:14     ` Jan Beulich
2022-12-13 22:26   ` [PATCH v2 03/14] x86/mm/shadow: avoid assuming a specific Xen PAT Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 04/14] efi: Avoid hard-coding the various PAT constants Demi Marie Obenour
2022-12-14  9:40     ` Jan Beulich
2022-12-13 22:26   ` [PATCH v2 05/14] x86/mm/shadow: do not open-code PAGE_CACHE_ATTRS Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 06/14] x86: Add memory type constants Demi Marie Obenour
2022-12-14 11:22     ` Jan Beulich [this message]
2022-12-13 22:26   ` [PATCH v2 07/14] x86: Replace PAT_* with X86_MT_* Demi Marie Obenour
2022-12-14 11:38     ` Jan Beulich
2022-12-13 22:26   ` [PATCH v2 08/14] x86: Replace MTRR_* constants with X86_MT_* constants Demi Marie Obenour
2022-12-14 11:54     ` Jan Beulich
2022-12-13 22:26   ` [PATCH v2 09/14] x86: Replace EPT_EMT_* constants with X86_MT_* Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 10/14] x86: Remove remaining uses of MTRR_* constants Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 11/14] x86: Derive XEN_MSR_PAT from its individual entries Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 12/14] x86/mm: make code robust to future PAT changes Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 13/14] x86/mm: Reject invalid cacheability in PV guests by default Demi Marie Obenour
2022-12-13 22:26   ` [PATCH v2 14/14] x86: Use Linux's PAT Demi Marie Obenour
2022-12-14  9:43   ` [PATCH v2 01/14] x86/mm: Avoid hard-coding PAT in get_page_from_l1e() Jan Beulich

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=1ecbb51a-02d5-1ee4-d484-0a16c52d2493@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=demi@invisiblethingslab.com \
    --cc=george.dunlap@citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.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.