QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	qemu-ppc@nongnu.org, hpoussin@reactos.org, atar4qemu@gmail.com,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH 4/5] ppc405_boards: use qdev properties instead of legacy m48t59_init() function
Date: Sat, 17 Oct 2020 12:16:45 +0100
Message-ID: <2e5e164a-71b4-b587-4513-d3b56dd0fc49@ilande.co.uk> (raw)
In-Reply-To: <8efee931-3314-7f3a-395b-3b840acdab90@amsat.org>

On 17/10/2020 10:45, Philippe Mathieu-Daudé wrote:

> On 10/16/20 10:38 PM, BALATON Zoltan via wrote:
>> On Fri, 16 Oct 2020, Mark Cave-Ayland wrote:
>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>> ---
>>> hw/ppc/ppc405_boards.c | 10 +++++++++-
>>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
>>> index 6198ec1035..4687715b15 100644
>>> --- a/hw/ppc/ppc405_boards.c
>>> +++ b/hw/ppc/ppc405_boards.c
>>> @@ -28,6 +28,8 @@
>>> #include "qemu-common.h"
>>> #include "cpu.h"
>>> #include "hw/ppc/ppc.h"
>>> +#include "hw/qdev-properties.h"
>>> +#include "hw/sysbus.h"
>>> #include "ppc405.h"
>>> #include "hw/rtc/m48t59.h"
>>> #include "hw/block/flash.h"
>>> @@ -145,6 +147,8 @@ static void ref405ep_init(MachineState *machine)
>>>     char *filename;
>>>     ppc4xx_bd_info_t bd;
>>>     CPUPPCState *env;
>>> +    DeviceState *dev;
>>> +    SysBusDevice *s;
>>>     qemu_irq *pic;
>>>     MemoryRegion *bios;
>>>     MemoryRegion *sram = g_new(MemoryRegion, 1);
>>> @@ -227,7 +231,11 @@ static void ref405ep_init(MachineState *machine)
>>>     /* Register FPGA */
>>>     ref405ep_fpga_init(sysmem, 0xF0300000);
>>>     /* Register NVRAM */
>>> -    m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8);
>>> +    dev = qdev_new("sysbus-m48t08");
>>> +    qdev_prop_set_int32(dev, "base-year", 1968);
>>
>> Is there anything that uses other than 1968 as base year? If not this could be the 
>> default in the device so you don't need these set prop calls here and in sun machines.
>>
>> The only other place this device is used seems to be ppc/prep machine that uses the 
>> isa version but does not set a base year. Is that a bug? The original prep machine 
>> removed in b2ce76a0730 used 2000 but that's unlikely as well as these machines 
>> predate that.
> 
> =)

This is quite interesting, since if you look at prep.c you see that the machine has 
both a MC146818 RTC and a M48T59 RTC, and the NVRAM variables are stored in the 
M48T59. My guess is that a real 40p has a MC146818, but OHW only supported M48T59 and 
so it was only ever used to pass data from QEMU to OHW - the OS would use MC146818 
for the clock which has the base year set correctly.

>> Anyway, the sysbus and isa versions are different
> 
> They shouldn't, it is the same chipset, wired differently.
> 
>> so their default base-year could be set independently and then boards won't need to 
>> set this propery and may be could use qdev_create_simple instead or whatever that 
>> was renamed to.
> 
> Agreed.
> 
> Preferably following Zoltan's suggestion:
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

There is certainly some more untangling to be done here, but given my current backlog 
it is something that will need to wait until after 5.2.


ATB,

Mark.


  parent reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 18:27 [PATCH 0/5] m48t59: remove legacy init functions Mark Cave-Ayland
2020-10-16 18:27 ` [PATCH 1/5] m48t59-isa: remove legacy m48t59_init_isa() function Mark Cave-Ayland
2020-10-17  9:39   ` Philippe Mathieu-Daudé
2020-10-16 18:27 ` [PATCH 2/5] sun4m: use qdev properties instead of legacy m48t59_init() function Mark Cave-Ayland
2020-10-17  9:42   ` Philippe Mathieu-Daudé
2020-10-17 11:07     ` Mark Cave-Ayland
2020-10-16 18:27 ` [PATCH 3/5] sun4u: " Mark Cave-Ayland
2020-10-17  9:43   ` Philippe Mathieu-Daudé
2020-10-16 18:27 ` [PATCH 4/5] ppc405_boards: " Mark Cave-Ayland
2020-10-16 20:38   ` BALATON Zoltan via
2020-10-17  9:45     ` Philippe Mathieu-Daudé
2020-10-17 10:44       ` BALATON Zoltan via
2020-10-17 11:53         ` Mark Cave-Ayland
2020-10-17 11:16       ` Mark Cave-Ayland [this message]
2020-10-17 14:41     ` Artyom Tarasenko
2020-10-16 18:27 ` [PATCH 5/5] m48t59: remove " Mark Cave-Ayland
2020-10-17  9:53   ` Philippe Mathieu-Daudé
2020-10-17 11:19     ` Mark Cave-Ayland
2020-10-17 13:57       ` Philippe Mathieu-Daudé
2020-10-16 20:21 ` [PATCH 0/5] m48t59: remove legacy init functions Hervé Poussineau

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=2e5e164a-71b4-b587-4513-d3b56dd0fc49@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=atar4qemu@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=david@gibson.dropbear.id.au \
    --cc=f4bug@amsat.org \
    --cc=hpoussin@reactos.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-trivial@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

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git
	git clone --mirror https://lore.kernel.org/qemu-devel/2 qemu-devel/git/2.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git