On 20/07/2015 12:53, Efimov Vasily wrote: > + read_src = address_space_translate(read_as, pam_offset, > + &offset_within_read_leaf, &unused, > + false); > + > + if (memory_region_is_ram(read_src) || memory_region_is_romd(read_src)) { > + /* Read source is RAM or ROM. > + Make current PAM region a ROM with body inside read source. */ > + cur->ram_addr = read_src->ram_addr + offset_within_read_leaf; > + cur->rom_device = true; > + cur->romd_mode = true; > + } else { > + /* Make current PAM region a clearly I/O region. */ > + cur->ram_addr = ~(ram_addr_t) 0; > + cur->rom_device = false; > + cur->romd_mode = false; > + } > + > + pam->write_as = write_as; > + pam->read_as = read_as; > +} > +
Hi Vasily, I agree that this patch is an improvement compared to the earlier versions, but it's still a bit of an abstraction violation and I'm not sure if it works with KVM. Let's see if we can improve things. Please correct me on the following: 1) For the "Make current PAM region a ROM" case, we can get the ram_addr_t directly from the pc.bios and pc.rom MemoryRegions, and poke into pam->region[1] and pam->region[2] when we create them. 2) For the "Make current PAM region an I/O region" case, you could add an IOMMU region that to 0xc0000-0xfffff. The listener would disable pam->region[1] if address_space_translate returns an I/O region and enable it if it returns RAM/ROM. However, I cannot understand or remember what is the case where you get an I/O region. Paolo