Hi Ayan,

On 22/11/2023 20:00, Ayan Kumar Halder wrote:
> Hi Amit/All,
> 
> We came across this scenario and would be helpful if you can provide 
> some pointers
> 
> 
> Linux running as Dom0 on Xen hypervisor with HVC_DCC = y and HVC_XEN = y 
> on Arm64 platform.
> 
> This causes a crash when Dom0 tries to access "DBGDTRTX_EL0" register, 
> it traps to Xen.
> 
> Xen does not emulate this register so it crashes.
> 
> |Logs - https://paste.debian.net/1298983/|
> 
> |
> |
> 
> |My aim is to avoid the crash and let Xen boot Dom0 even though there 
> might not be a debug console available.|
> 
> |So, I am trying to add emulation for |"DBGDTRTX_EL0" register in Xen.
> 
> 
> As a quick trial (may be not the perfect solution), I am trying to 
> emulate this register as "read as zero/write ignore" (similar to KVM).
> 
> However, I could not see logs to the Xen console (ie HVC0).
> 
> 
> So my question is
> 
> 1. Is it possible in Linux to probe more than one HVC console so that 
> Linux can put the same logs in HVC_DCC and HVC_XEN drivers ?
> 
> So that the user can always see the logs in the default Xen console (ie 
> hvc0) even if the debug console is not present.
If you have both HVC DCC and Xen enabled and DCC gets assigned hvc0, just use 
console=hvc1
to see the messages from Xen.
> 
> 
> Another possible alternative I am exploring is to enable trapping for 
> read of MDCCSR_EL0 in Xen, so that Xen returns with MDCCSR_EL0.TXfull 
> set to 1.
> 
> static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
> {
>      int i;
> 
>      for (i = 0; i < count; i++) {
>          while (__dcc_getstatus() & DCC_STATUS_TX)
>              cpu_relax(); <<<<<<<<<<----------- So this will be invoked.
FWICS, this won't be invoked given that in init call hvc_dcc_check() will 
return false
due to condition "if (!(__dcc_getstatus() & DCC_STATUS_TX))" being false. This 
is the whole
point to make Linux return -ENODEV quickly.

~Michal

Reply via email to