<div dir="ltr"><div><div>Dear Kevin,</div><div>    Thanks for getting back to me. Your replay helps me a lot. And there are two things I want to make clear.</div><div>    1. > The real-mode handlers installed at 0x60-0x66 are intended for software interrupts.</div><div><span style="white-space:pre">     </span>During the booting of the vm seabios, which modules will raise the software interrupts? (Qemu? KVM? VirtualMachine?)</div><div><span style="white-space:pre">  </span></div><div>    2. In src/post.c: init_ivt, the handlers for 0x60-0x66 is set to none as below.</div><div><span style="white-space:pre">  </span></div><div>    for (i=0x60; i<=0x66; i++)</div><div>        SET_IVT(i, SEGOFF(0, 0));</div><div><span style="white-space:pre">        </span></div><div>    If I change the handlers of 0x60-0x66 to default handler, which is "iret" directly, is there some side effects? </div><div class="gmail_extra"><br><div class="gmail_quote">2018-03-27 0:33 GMT+08:00 Kevin O'Connor <span dir="ltr"><<a href="mailto:kevin@koconnor.net" target="_blank">kevin@koconnor.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-m_23252137105723140HOEnZb"><div class="gmail-m_23252137105723140h5">On Thu, Mar 22, 2018 at 11:40:46AM +0800, Zhe Liu wrote:<br>
> Hi!<br>
> Recently, I encountered a seabios hanging problem. When I try to inject an<br>
> MSI-X interrupt along with SMI in qemu like below:<br>
> *************** patch below*********************<br>
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c- a/target-i386/kvm.c<br>
><br>
><br>
> ---   a/target-i386/kvm.c<br>
> +++   b/target-i386/kvm.c<br>
><br>
> @@ -104,6 +104,7 @@ static uint32_t num_architectural_pmu_counters<wbr>;<br>
>  static int has_xsave;<br>
>  static int has_xcrs;<br>
>  static int has_pit_state2;<br>
> +static int msi_count;<br>
><br>
> static bool has_msr_mcg_ext_ctl;<br>
><br>
> @@ -2870,12 +2871, 26 @@ void kvm_arch_pre_run(CPUState *cpu, struct<br>
> kvm_run *run)<br>
> DPRINTF("inject SMI\n");<br>
> + MSIMessage msg = {.address = 0x0, .data = 0x4062};<br>
> + if (msi_count == 1) {<br>
> + ret = kvm_irqchip_send_msi(kvm_state<wbr>, msg);<br>
> + if (ret <0) {<br>
> + QEMU_LOG(LOG_ALERT, "MSI lost %s\n", strerror(-ret));<br>
> + }<br>
> + }<br>
> + msi_count++;<br>
><br>
> ret = kvm_vcpu_ioctl(cpu, KVM_SMI);<br>
> if (ret < 0)<br>
> **************patch above*************************<br>
><br>
> Then, when the vm will hang when booting.<br>
> There will be only one line in the vnc displayer:<br>
> "Guest has not initialized the display(yet)"<br>
><br>
> I went through the codes(kvm qemu seabios), and I found the check_irqs<br>
> function in seabios will allow interrupt for a while.<br>
> When the interrupt triggered, the vcpu will lookup the seabios IDT table<br>
> and jump to the interrupt handler.<br>
><br>
> However, in ivt_init(void), the entries from 0x60 to 0x66 will be cleared,<br>
> which is configured by the patch below.<br>
><br>
> <a href="https://github.com/coreboot/seabios/commit/b164d2c1b8ff2dd764dcf064e2624dd4aa78c112" rel="noreferrer" target="_blank">https://github.com/coreboot/se<wbr>abios/commit/b164d2c1b8ff2dd76<wbr>4dcf064e2624dd4aa78c112</a><br>
><br>
> So the vcpu will jump to an undefined entry instead of the default entry.<br>
><br>
> ==============================<wbr>==============================<wbr>=============<br>
> I removed the patch, and the bug seems to disappear. I wonder if this is an<br>
> approprite solution.<br>
<br>
</div></div>This doesn't seem like a SeaBIOS issue.  The real-mode handlers<br>
installed at 0x60-0x66 are intended for software interrupts; not for<br>
hardware raised interrupts.<br>
<br>
I don't know why the machine irq routing would deliver a hardware<br>
interrupt to that vector, but I suspect that is what needs to be<br>
looked at.<br>
<span class="gmail-m_23252137105723140HOEnZb"><font color="#888888"><br>
-Kevin<br>
</font></span></blockquote></div><br></div></div></div>