qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Leon Alrae <leon.alrae@imgtec.com>, aurelien@aurel32.net
Cc: paul.burton@imgtec.com, qemu-devel@nongnu.org,
	Anthony Liguori <anthony@codemonkey.ws>,
	yongbok.kim@imgtec.com, Paolo Bonzini <pbonzini@redhat.com>,
	cristian.cuna@imgtec.com
Subject: Re: [Qemu-devel] [PATCH 2/6] mips_malta: correct reading MIPS revision at 0x1fc00010
Date: Mon, 29 Jul 2013 06:33:29 +0200	[thread overview]
Message-ID: <51F5F099.4030504@suse.de> (raw)
In-Reply-To: <1371195048-19618-3-git-send-email-leon.alrae@imgtec.com>

Am 14.06.2013 09:30, schrieb Leon Alrae:
> From: Paul Burton <paul.burton@imgtec.com>
> 
> Rather than modifying the BIOS code at its original location, copy it
> for the 0x1fc00000 region & modify the copy. This means the original
> ROM code is correctly readable at 0x1e000010 whilst the MIPS revision
> is readable at 0x1fc00010.
> 
> Additionally the code previously operated on target memory which would
> later be overwritten by the BIOS image upon CPU reset if the -bios
> argument was used to specify the BIOS image. This led to the written
> MIPS revision being lost. Copying using rom_copy when -bios is used
> fixes this issue.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
> ---
>  hw/mips/mips_malta.c |   25 +++++++++++++++++--------
>  1 files changed, 17 insertions(+), 8 deletions(-)

For some reason this commit breaks `make check`, please revert or fix.

Andreas

> 
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 4def898..9117ae4 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -789,7 +789,7 @@ void mips_malta_init(QEMUMachineInitArgs *args)
>      pflash_t *fl;
>      MemoryRegion *system_memory = get_system_memory();
>      MemoryRegion *ram = g_new(MemoryRegion, 1);
> -    MemoryRegion *bios, *bios_alias = g_new(MemoryRegion, 1);
> +    MemoryRegion *bios, *bios_copy = g_new(MemoryRegion, 1);
>      target_long bios_size = FLASH_SIZE;
>      int64_t kernel_entry;
>      PCIBus *pci_bus;
> @@ -929,14 +929,23 @@ void mips_malta_init(QEMUMachineInitArgs *args)
>  #endif
>      }
>  
> -    /* Map the BIOS at a 2nd physical location, as on the real board. */
> -    memory_region_init_alias(bios_alias, "bios.1fc", bios, 0, BIOS_SIZE);
> -    memory_region_add_subregion(system_memory, RESET_ADDRESS, bios_alias);
> +    /*
> +     * Map the BIOS at a 2nd physical location, as on the real board.
> +     * Copy it so that we can patch in the MIPS revision, which cannot be
> +     * handled by an overlapping region as the resulting ROM code subpage
> +     * regions are not executable.
> +     */
> +    memory_region_init_ram(bios_copy, "bios.1fc", BIOS_SIZE);
> +    if (!rom_copy(memory_region_get_ram_ptr(bios_copy),
> +                  FLASH_ADDRESS, bios_size)) {
> +        memcpy(memory_region_get_ram_ptr(bios_copy),
> +               memory_region_get_ram_ptr(bios), bios_size);
> +    }
> +    memory_region_set_readonly(bios_copy, true);
> +    memory_region_add_subregion(system_memory, RESET_ADDRESS, bios_copy);
>  
> -    /* Board ID = 0x420 (Malta Board with CoreLV)
> -       XXX: theoretically 0x1e000010 should map to flash and 0x1fc00010 should
> -       map to the board ID. */
> -    stl_p(memory_region_get_ram_ptr(bios) + 0x10, 0x00000420);
> +    /* Board ID = 0x420 (Malta Board with CoreLV) */
> +    stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420);
>  
>      /* Init internal devices */
>      cpu_mips_irq_init_cpu(env);
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2013-07-29  4:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14  7:30 [Qemu-devel] [PATCH 0/6] mips_malta: fixes to support YAMON firmware Leon Alrae
2013-06-14  7:30 ` [Qemu-devel] [PATCH 1/6] mips_malta: fix BIOS endianness swapping Leon Alrae
2013-06-14  7:30 ` [Qemu-devel] [PATCH 2/6] mips_malta: correct reading MIPS revision at 0x1fc00010 Leon Alrae
2013-07-29  4:33   ` Andreas Färber [this message]
2013-06-14  7:30 ` [Qemu-devel] [PATCH 3/6] mips_malta: generate SPD EEPROM data at runtime Leon Alrae
2013-06-14  7:30 ` [Qemu-devel] [PATCH 4/6] mips_malta: cap BIOS endian swap length at 0x3e0000 bytes Leon Alrae
2013-06-14  7:30 ` [Qemu-devel] [PATCH 5/6] mips_malta: generate SMBUS EEPROM data Leon Alrae
2013-06-14  7:30 ` [Qemu-devel] [PATCH 6/6] pflash_cfi01: duplicate status byte from bits 23:16 for 32bit reads Leon Alrae
2013-06-28 13:20 ` [Qemu-devel] [PATCH 0/6] mips_malta: fixes to support YAMON firmware Leon Alrae
2013-07-18  7:34   ` Leon Alrae
2013-07-28 22:24 ` Aurelien Jarno

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=51F5F099.4030504@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=aurelien@aurel32.net \
    --cc=cristian.cuna@imgtec.com \
    --cc=leon.alrae@imgtec.com \
    --cc=paul.burton@imgtec.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@imgtec.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 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).