All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: aik@ozlabs.ru, jan.kiszka@siemens.com, qemu-devel@nongnu.org,
	qemulist@gmail.com, stefanha@redhat.com,
	david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCH 12/40] memory: add address_space_translate
Date: Mon, 20 May 2013 12:41:36 +0200	[thread overview]
Message-ID: <5199FDE0.30200@redhat.com> (raw)
In-Reply-To: <CAFEAcA93V7ojapkf8JsfiPanTKu1crdenRmX3GvZ3GfK+spx0w@mail.gmail.com>

Il 07/05/2013 20:08, Peter Maydell ha scritto:
>> >
>> > -    section = phys_page_find(address_space_memory.dispatch, addr >> TARGET_PAGE_BITS);
>> > +    section = address_space_translate(&address_space_memory, addr, &addr, &l,
>> > +                                      false);
> I find it a little confusing reusing 'addr' for the returned
> offset from address_space_translate(); maybe using a different
> variable would be clearer? (don't feel very strongly about it)

True, on the other hand this matches usage before this patch.

-        addr = memory_region_section_addr(section, addr);

>> > +    if (l < 4) {
>> > +        return -1;
>> > +    }
>> >
>> >      if (!(memory_region_is_ram(section->mr) ||
>> >            memory_region_is_romd(section->mr))) {
>> >          /* I/O case */
>> > -        addr = memory_region_section_addr(section, addr);
>> >          val = io_mem_read(section->mr, addr, 4);
>> >  #if defined(TARGET_WORDS_BIGENDIAN)
>> >          if (endian == DEVICE_LITTLE_ENDIAN) {
>> > @@ -2249,7 +2240,7 @@ static inline uint32_t ldl_phys_internal(hwaddr addr,
>> >          /* RAM case */
>> >          ptr = qemu_get_ram_ptr((memory_region_get_ram_addr(section->mr)
>> >                                  & TARGET_PAGE_MASK)
>> > -                               + memory_region_section_addr(section, addr));
>> > +                               + addr);

>>
>> -    section = phys_page_find(address_space_memory.dispatch, addr >> TARGET_PAGE_BITS);
>> +    section = address_space_translate(&address_space_memory, addr, &addr, &l,
>> +                                      false);
>> +    if (l < 2) {
>> +        return -1;
>> +    }
> 
> This kind of "let's just return -1 if the read failed" kind
> of bothers me, because "memory access aborted" is really
> completely different from "memory access succeeded and
> returned -1". But there are a lot of APIs which we'd need
> to fix to properly communicate the problem back to the
> caller, so let it slide for now. (What used to happen
> in the old code in this case?)

It would call unassigned_mem_read and return 0.  I'll change this to
call unassigned_mem_read, which also requires fixing the "double use" of
addr that you pointed out above.

Paolo

  reply	other threads:[~2013-05-20 10:41 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 14:16 [Qemu-devel] [PATCH 00/40] Memory-related changes sneak peek for 1.6 Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 01/40] memory: assert that PhysPageEntry's ptr does not overflow Paolo Bonzini
2013-05-07 15:44   ` Peter Maydell
2013-05-07 16:08     ` Paolo Bonzini
2013-05-07 16:17       ` Peter Maydell
2013-05-09  3:41       ` liu ping fan
2013-05-09 16:46         ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 02/40] memory: allow memory_region_find() to run on non-root memory regions Paolo Bonzini
2013-05-07 15:35   ` Peter Maydell
2013-05-09  0:46   ` liu ping fan
2013-05-07 14:16 ` [Qemu-devel] [PATCH 03/40] memory: Replace open-coded memory_region_is_romd Paolo Bonzini
2013-05-07 15:59   ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 04/40] memory: Rename readable flag to romd_mode Paolo Bonzini
2013-05-07 16:10   ` Peter Maydell
2013-05-07 17:04     ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2013-05-07 17:07       ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 05/40] memory: do not duplicate memory_region_destructor_none Paolo Bonzini
2013-05-07 14:36   ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 06/40] memory: make memory_global_sync_dirty_bitmap take an AddressSpace Paolo Bonzini
2013-05-07 14:59   ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 07/40] memory: fix address space initialization/destruction Paolo Bonzini
2013-05-07 15:46   ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 08/40] memory: limit sections in the radix tree to the actual address space size Paolo Bonzini
2013-05-07 17:13   ` Peter Maydell
2013-05-07 17:24     ` Paolo Bonzini
2013-05-07 17:37       ` Alexander Graf
2013-05-07 14:16 ` [Qemu-devel] [PATCH 09/40] memory: create FlatView for new address spaces Paolo Bonzini
2013-05-07 17:25   ` Peter Maydell
2013-05-08  8:41     ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 10/40] exec: remove obsolete comment Paolo Bonzini
2013-05-07 14:25   ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 11/40] memory: add address_space_valid Paolo Bonzini
2013-05-07 17:40   ` Peter Maydell
2013-05-13 14:03     ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 12/40] memory: add address_space_translate Paolo Bonzini
2013-05-07 18:08   ` Peter Maydell
2013-05-20 10:41     ` Paolo Bonzini [this message]
2013-05-07 14:16 ` [Qemu-devel] [PATCH 13/40] memory: Introduce address_space_lookup_region Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 14/40] memory: iommu support Paolo Bonzini
2013-05-07 18:15   ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 15/40] vfio: abort if an emulated iommu is used Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 16/40] spapr: convert TCE API to use an opaque type Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 17/40] spapr: make IOMMU translation go through IOMMUTLBEntry Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 18/40] spapr: use memory core for iommu support Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 19/40] dma: eliminate old-style IOMMU support Paolo Bonzini
2013-05-07 18:20   ` Peter Maydell
2013-05-13 14:04     ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 20/40] pci: use memory core for iommu support Paolo Bonzini
2013-05-07 18:30   ` Peter Maydell
2013-05-11  5:09     ` liu ping fan
2013-05-11  8:07       ` Peter Maydell
2013-05-10 13:07   ` Alexey Kardashevskiy
2013-05-10 13:55     ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 21/40] spapr_vio: take care of creating our own AddressSpace/DMAContext Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 22/40] dma: eliminate DMAContext Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 23/40] memory: give name to every AddressSpace Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 24/40] memory: add getter/setter for owner Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 25/40] memory: add ref/unref Paolo Bonzini
2013-05-08  9:05   ` Stefan Hajnoczi
2013-05-07 14:17 ` [Qemu-devel] [PATCH 26/40] memory: add ref/unref calls Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 27/40] pci: set owner for BARs Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 28/40] sysbus: set owner for MMIO regions Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 29/40] acpi: add memory_region_set_owner calls Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 30/40] misc: " Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 31/40] isa/portio: allow setting an owner Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 32/40] vga: add memory_region_set_owner calls Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 33/40] pci-assign: " Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 34/40] vfio: " Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 35/40] exec: check MRU in qemu_ram_addr_from_host Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 36/40] memory: return MemoryRegion from qemu_ram_addr_from_host Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 37/40] memory: ref/unref memory across address_space_map/unmap Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 38/40] memory: access FlatView from a local variable Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 39/40] memory: use a new FlatView pointer on every topology update Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 40/40] memory: add reference counting to FlatView Paolo Bonzini
2013-05-07 18:00   ` Jan Kiszka
2013-05-07 18:10     ` Jan Kiszka
2013-05-07 19:44     ` Paolo Bonzini
2013-05-08  7:57       ` Jan Kiszka

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=5199FDE0.30200@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=jan.kiszka@siemens.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.com \
    --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.