qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] via-ide: Fix fuloong2e support


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 2/2] via-ide: Fix fuloong2e support
Date: Tue, 29 Dec 2020 11:56:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

On 12/28/20 9:50 PM, BALATON Zoltan via wrote:
> On Mon, 28 Dec 2020, Mark Cave-Ayland wrote:
>> On 27/12/2020 22:13, BALATON Zoltan via wrote:
>>
>>> From: Guenter Roeck <linux@roeck-us.net>
>>>
>>> The IDE legacy mode emulation has been removed in commit 4ea98d317eb
>>> ("ide/via: Implement and use native PCI IDE mode") but some Linux
>>> kernels (probably including def_config) require legacy mode on the
>>> Fuloong2e so only emulating native mode did not turn out feasible.
>>> Add property to via-ide model to make the mode configurable, and set
>>> legacy mode for Fuloong2e.
>>>
>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>> [balaton: Use bit in flags for property, add comment for missing BAR4]
>>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> Tested-by: Guenter Roeck <linux@roeck-us.net>
>>> ---
>>> v2: Reworded commit message
>>>
>>>   hw/ide/via.c        | 19 +++++++++++++++++--
>>>   hw/mips/fuloong2e.c |  4 +++-
>>>   2 files changed, 20 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/ide/via.c b/hw/ide/via.c
>>> index be09912b33..7d54d7e829 100644
>>> --- a/hw/ide/via.c
>>> +++ b/hw/ide/via.c
>>> @@ -26,6 +26,7 @@
>>>     #include "qemu/osdep.h"
>>>   #include "hw/pci/pci.h"
>>> +#include "hw/qdev-properties.h"
>>>   #include "migration/vmstate.h"
>>>   #include "qemu/module.h"
>>>   #include "sysemu/dma.h"
>>> @@ -185,12 +186,19 @@ static void via_ide_realize(PCIDevice *dev,
>>> Error **errp)
>>>                             &d->bus[1], "via-ide1-cmd", 4);
>>>       pci_register_bar(dev, 3, PCI_BASE_ADDRESS_SPACE_IO,
>>> &d->cmd_bar[1]);
>>>   -    bmdma_setup_bar(d);
>>> -    pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
>>> +    if (!(d->flags & BIT(PCI_IDE_LEGACY_MODE))) {
>>> +        /* Missing BAR4 will make Linux driver fall back to legacy
>>> PIO mode */
>>> +        bmdma_setup_bar(d);
>>> +        pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO,
>>> &d->bmdma_bar);
>>> +    }
>>
>> Since the default value of the legacy mode parameter is false, then
>> this means the device assumes native mode by default. Therefore
>> PCI_CLASS_PROG should be set to 0x8f unless legacy mode is being used,
>> in which case it should be 0x8a.
> 
> I think this casued problems before because if it's not set to 0x8a
> (legacy) at start then guests may assume it's already switched to native
> mode by firmware and won't program the BARs and it will not work. This
> way, even if it looks odd all guests I've tested work so I don't want to
> touch this, because I don't want to test all guests again.

If you can describe on the list how you do your testing (mostly
command line used, where image/demo can be downloaded), we might help
writing an integration test to automate the testing. Don't worry if
it involves using close-source binaries, we'll try to figure out a
way.

Regards,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]