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

Re: Xen Arm vpl011 UART will cause segmentation fault in Linux guest



On Wed, 16 Nov 2022, Andre Przywara wrote:
> On Thu, 10 Nov 2022 12:32:49 -0800 (PST)
> Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> > On Wed, 9 Nov 2022, Michal Orzel wrote:
> > > Hi Jiamei,
> > > 
> > > On 09/11/2022 09:25, Jiamei Xie wrote:  
> > > > 
> > > > 
> > > > Hi Michal,
> > > > 
> > > > Below log can be got when stating the linux guest. It says 9c09 is 
> > > > sbsa. And 9c09 is also output
> > > >  in bootlogd error message:
> > > > Serial: AMBA PL011 UART driver
> > > > 9c0b0000.uart: ttyAMA0 at MMIO 0x9c0b0000 (irq = 12, base_baud = 0) is 
> > > > a PL011 rev2
> > > > printk: console [ttyAMA0] enabled
> > > > 9c090000.sbsa-uart: ttyAMA1 at MMIO 0x9c090000 (irq = 15, base_baud = 
> > > > 0) is a SBSA
> > > >   
> > > 
> > > Xen behavior is correct and this would be Linux fault to try to write to 
> > > DMACR for SBSA UART device.
> > > DMACR is just an example. If you try to program e.g. the baudrate 
> > > (through LCR) for VPL011 it will
> > > also result in injecting abort into the guest. Should Xen support it? No. 
> > > The reason why is that
> > > it is not spec compliant operation. SBSA specification directly specifies 
> > > what registers are exposed.
> > > If Linux tries to write to some of the none-spec compliant registers - it 
> > > is its fault.  
> > 
> > Yeah, we need to fix Linux.
> 
> Yes, it's a bug in Linux, and nobody noticed because most SBSA UARTs are
> actual PL011s, just not with everything wired up and the clocks fixed.
> 
> But while you can take pride all day in Xen having a perfect
> spec-compliant implementation - and you would be right - you have to face
> the reality that existing Linux kernels will crash.
> So we will add the one-liner in Linux that fixes that issue, and this will
> probably be backported to stable kernels, but you will still encounter
> kernels without the fix in the wild.
> So I wonder if you should consider to just implement the other PL011
> registers as RAZ/WI? That would be spec compliant as well (since an actual
> PL011 is also a spec-compliant SBSA-UART), but would work either way. Of
> course you don't need to implement the DMA or baudrate functionality, but
> at least not be nasty and trap on those register accesses.

I think this is one of those cases where we should do both:
- we should fix Linux, because that is a bug in Linux
- we should improve Xen to make this class of issues less likely to show
  up in the future

So I think implementing the other PL011 registers as RAZ/WI is a good
improvement we could have in Xen.

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.