All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Andrey Smirnov <andrew.smirnov@gmail.com>,
	Chris Healy <cphealy@gmail.com>, Jason Wang <jasowang@redhat.com>,
	Jean-Christophe Dubois <jcd@tribudubois.net>,
	Bill Paul <wpaul@windriver.com>
Subject: Re: [Qemu-devel] [PATCH] fsl-imx6: Swap Ethernet interrupt defines
Date: Thu, 8 Mar 2018 06:47:45 -0800	[thread overview]
Message-ID: <1cb9cc42-c7c9-5124-a615-27914d23b05c@roeck-us.net> (raw)
In-Reply-To: <CAFEAcA8iFYGhzmLm6pyZi6tg=Di1P=vi_Enyw_ia1M34B3t8aw@mail.gmail.com>

On 03/08/2018 02:50 AM, Peter Maydell wrote:
> On 7 March 2018 at 17:37, Guenter Roeck <linux@roeck-us.net> wrote:
>> The sabrelite machine model used by qemu-system-arm is based on the
>> Freescale/NXP i.MX6Q processor. This SoC has an on-board ethernet
>> controller which is supported in QEMU using the imx_fec.c module
>> (actually called imx.enet for this model.)
>>
>> The include/hw/arm/fsm-imx6.h file defines the interrupt vectors for the
>> imx.enet device like this:
>>
>>   #define FSL_IMX6_ENET_MAC_1588_IRQ 118
>>   #define FSL_IMX6_ENET_MAC_IRQ 119
>>
>> According to https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf,
>> page 225, in Table 3-1. ARM Cortex A9 domain interrupt summary,
>> interrupts are as follows.
>>
>> 150 ENET MAC 0 IRQ
>> 151 ENET MAC 0 1588 Timer interrupt
>>
>> where
>>
>> 150 - 32 == 118
>> 151 - 32 == 119
>>
>> In other words, the vector definitions in the fsl-imx6.h file are reversed.
>>
>> This results in lost interrupt warnings when running recent (v4.15+) Linux
>> kernels, and the Ethernet interface will fail to probe.
>>
>> Note that applying this patch will cause problems with older Linux kernels:
>> The Ethernet interface will fail to probe with Linux v4.9 and earlier.
>> Linux v4.1 and earlier will crash. This is a Linux kernel problem, not a
>> qemu problem: the Linux kernel only worked by accident since it requested
>> both interrupts.
> 
> So do the works-by-accident kernels fail on QEMU because
> we don't emulate some bit of the ethernet device ?
> Ideally we could fix that so we could boot newer kernels
> without breaking the old ones...
> 

As mentioned, older versions of Linux assign both interrupt lines instead of one
to the Ethernet interrupt handler. After applying this patch, this causes the probe
function to fail. This in turn results in 4.1 and earlier to crash, This is fixed
by applying upstream commit 32cba57ba7 to those kernels. I asked upstream maintainers
to apply this patch to 3.18.y and 4.1.y.

The wrong interrupt problem is solved in Linux with upstream commit 4c8777892e80b,
as I pointed out in bugzilla. With this patch applied, older versions of Linux (4.9
and older) work with qemu, both with and without this patch. What I don't know is if
older versions of Linux still work on real hardware with 4c8777892e80b applied.

I don't know if a fix working for all versions of Linux is even possible. Creating both
interrupts might be an option, but would likely cause other problems since some versions
of Linux would handle the same interrupt twice, while others expect the second interrupt
to be associated with the timer.

Guenter

  reply	other threads:[~2018-03-08 14:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 17:37 [Qemu-devel] [PATCH] fsl-imx6: Swap Ethernet interrupt defines Guenter Roeck
2018-03-08 10:50 ` Peter Maydell
2018-03-08 14:47   ` Guenter Roeck [this message]
2018-03-08 14:51     ` Peter Maydell
2018-03-08 15:05       ` Guenter Roeck
2018-03-08 17:12       ` Guenter Roeck
2018-03-08 18:28         ` Bill Paul
2018-03-08 19:22           ` Guenter Roeck
2018-03-09 17:47           ` Peter Maydell
2018-03-09 18:20             ` Guenter Roeck
2018-03-09 18:48               ` Peter Maydell
2018-03-09 20:19                 ` Guenter Roeck
2018-03-09 18:53               ` Bill Paul
2018-03-09 18:57                 ` Bill Paul
2018-03-09 21:38                 ` Guenter Roeck
2018-03-09 23:03                   ` Bill Paul

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=1cb9cc42-c7c9-5124-a615-27914d23b05c@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=andrew.smirnov@gmail.com \
    --cc=cphealy@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=jcd@tribudubois.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wpaul@windriver.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.