All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin O'Connor <kevin@koconnor.net>
To: "Marc Marí" <markmb@redhat.com>
Cc: "Gabriel L. Somlo" <somlo@cmu.edu>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Laszlo <lersek@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3] Add optionrom compatible with fw_cfg DMA version
Date: Thu, 28 Jan 2016 10:24:10 -0500	[thread overview]
Message-ID: <20160128152410.GA22389@morn.lan> (raw)
In-Reply-To: <20160128122033.10347566@markmb_rh>

On Thu, Jan 28, 2016 at 12:20:33PM +0100, Marc Marí wrote:
> A small cosmetic comment in this patch: is there any practical reason to
> mix the three ways to put inline assembly (asm(), asm volatile() and
> __asm__ __volatile__ ()) in this patch?

No reason - it was just copy-and-paste crud.

> 
> Thanks for your comments
> Marc
> 
> Patch for segmentation:
> 
> --- a/pc-bios/optionrom/linuxboot_dma.c
> +++ b/pc-bios/optionrom/linuxboot_dma.c
> @@ -91,23 +91,28 @@ static inline void outl(uint32_t value, uint16_t
> port) {
>      asm("outl %0, %w1" : : "a"(value), "Nd"(port));
>  }
>  
> -static inline uint16_t readw_addr32(const void *addr) {
> +static inline void set_setup_addr(void *addr) {
> +    uint32_t seg = (uint32_t)addr >> 4;
> +    asm("movl %0, %%es\n" : : "r"(seg));
> +}

As a minor comment, I think using "set_es()" and "readw_es()" would be
a little more descriptive.

> +static inline uint16_t readw_setup(uint16_t offset) {
>      uint16_t val;
> -    asm("addr32 movw %1, %0" : "=r"(val) : "g"(addr));
> +    asm("addr32 movw %%es:(%1), %0" : "=r"(val) :
> "r"((uint32_t)offset)); barrier();
>      return val;
>  }

SeaBIOS uses slightly different assembler - see the READx_SEG() macros
at the top of farptr.h.  That said, the above assembler is probably
also fine.

https://github.com/KevinOConnor/seabios/blob/rel-1.9.0/src/farptr.h#L16

-Kevin

  reply	other threads:[~2016-01-28 15:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 13:17 [Qemu-devel] [PATCH v3] Add optionrom compatible with fw_cfg DMA version Marc Marí
2016-01-26 11:11 ` Stefan Hajnoczi
2016-01-26 11:20   ` Marc Marí
2016-01-26 11:26     ` Gerd Hoffmann
2016-01-27 16:43       ` Stefan Hajnoczi
2016-01-27 16:57         ` Marc Marí
2016-01-27 17:17           ` Kevin O'Connor
2016-01-28 10:18             ` Marc Marí
2016-01-28 10:55               ` Stefan Hajnoczi
2016-01-28  0:14 ` Kevin O'Connor
2016-01-28 11:20   ` Marc Marí
2016-01-28 15:24     ` Kevin O'Connor [this message]
2016-01-28 21:06   ` Marc Marí

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=20160128152410.GA22389@morn.lan \
    --to=kevin@koconnor.net \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=markmb@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=somlo@cmu.edu \
    --cc=stefanha@redhat.com \
    /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.