qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: akong@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] PIIX: reset the VM when the Reset Control Register's RCPU bit gets set
Date: Fri, 11 Jan 2013 10:30:12 +0100	[thread overview]
Message-ID: <50EFDBA4.4050201@redhat.com> (raw)
In-Reply-To: <CAAu8pHuGhYaA1PFWEeEa5mfyo03t=dKoHZmQjKZah_YOH5G5HQ@mail.gmail.com>

Hi,

On 01/09/13 22:01, Blue Swirl wrote:
> On Tue, Jan 8, 2013 at 9:44 PM, Laszlo Ersek <lersek@redhat.com> wrote:

>> +static void i440fx_host_config_write(void *opaque, hwaddr addr,
>> +                                     uint64_t val, unsigned len)
>> +{
>> +    if (addr == 1 && len == 1) {
>> +        if (val & 4) {
>> +            qemu_system_reset_request();
>> +        }
>> +        return;
>> +    }
>> +    pci_host_conf_le_ops.write(opaque, addr, val, len);
>> +}
>> +
>> +static MemoryRegionOps i440fx_host_conf_ops = {
>> +    .read       = NULL,
>> +    .write      = i440fx_host_config_write,
>> +    .endianness = DEVICE_LITTLE_ENDIAN
>> +};
>> +
>>  static int i440fx_pcihost_initfn(SysBusDevice *dev)
>>  {
>>      PCIHostState *s = PCI_HOST_BRIDGE(dev);
>>
>> -    memory_region_init_io(&s->conf_mem, &pci_host_conf_le_ops, s,
>> +    i440fx_host_conf_ops.read = pci_host_conf_le_ops.read;
> 
> It would be cleaner to introduce a new memory region (without this
> copying) which passes 0xcf8 and 0xcfc to standard PCI host but catches
> accesses to 0xcf9. This may mean that pci_host_config_{read,write}
> will need to be exposed.

Do you mean:

(1) introducing the new "i440fx_host_conf_ops" struct-of-funcptrs with
detached functions (that is, duplicating the guts of
pci_host_config_{read,write} and modifying them, and then registering
s->conf_mem with this "i440fx_host_conf_ops"; or

(2) leaving s->conf_mem as-is, and introducing a sub-region just for
port 0xcf9, with higher visibility priority?

(I don't feel confident about (2), and based on "docs/memory.txt" I
thought that overlapping regions had not been invented for this purpose.)

IOW, are you OK with the explicit offset + access-width based check,
just organized differently, or are you proposing a one-byte-wide subregion?

Thanks!
Laszlo

  reply	other threads:[~2013-01-11  9:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 21:44 [Qemu-devel] [RFC PATCH] PIIX: reset the VM when the Reset Control Register's RCPU bit gets set Laszlo Ersek
2013-01-09 21:01 ` Blue Swirl
2013-01-11  9:30   ` Laszlo Ersek [this message]
2013-01-11 12:10     ` Andreas Färber
2013-01-11 12:20   ` Laszlo Ersek
2013-01-12 12:13     ` Blue Swirl
2013-01-14 17:05       ` Laszlo Ersek
2013-01-14 17:54         ` Laszlo Ersek

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=50EFDBA4.4050201@redhat.com \
    --to=lersek@redhat.com \
    --cc=akong@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.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 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).