static int process_session_event(struct oh_handler *h, RPTable *rpt, struct oh_hpi_event *e) { SaHpiRptEntryT *res; GSList *i; unsigned int log_severity; data_access_lock(); res = oh_get_resource_by_id(rpt, e->parent); if (res == NULL) { dbg("No resource"); data_access_unlock(); return -1; } if (res->ResourceCapabilities & SAHPI_CAPABILITY_MANAGED_HOTSWAP && e->event.EventType == SAHPI_ET_HOTSWAP) { hotswap_push_event(e); } /* Domain System Event Logging Mechanism. Check the handler configuration for the "log_severity" value and log everything equal or above that severity value. If there is no "log_severity" configured for the handler, then the default bar will be SAHPI_INFORMATIONAL. */ log_severity = get_log_severity(getenv("OPENHPI_LOG_SEV")); if (e->event.Severity <= log_severity) { struct oh_domain *d; SaHpiSelEntryT selentry; /* yes, we need to add real domain support later here */ d = get_domain_by_id(OH_DEFAULT_DOMAIN_ID); selentry.Event = e->event; oh_sel_add(d->sel, &selentry); } g_slist_for_each(i, global_session_list) { struct oh_session *s = i->data; /* yes, we need to add real domain support later here */ if (s->domain_id == SAHPI_DEFAULT_DOMAIN_ID && (s->event_state == OH_EVENT_SUBSCRIBE || (s->event_state == OH_EVENT_UNSUBSCRIBE && (e->event.Severity == SAHPI_MINOR || e->event.Severity == SAHPI_MAJOR || e->event.Severity == SAHPI_CRITICAL)))) { /* Push event if session is subscribed, or, if session is unsubscribed, the event is an active alarm. */ session_push_event(s, e); } } data_access_unlock(); return 0; }
void mc_memerr_dhandler(struct mca_binfo *binfo, enum mce_result *result, struct cpu_user_regs *regs) { struct mcinfo_bank *bank = binfo->mib; struct mcinfo_global *global = binfo->mig; struct domain *d; unsigned long mfn, gfn; uint32_t status; int vmce_vcpuid; if (!mc_check_addr(bank->mc_status, bank->mc_misc, MC_ADDR_PHYSICAL)) { dprintk(XENLOG_WARNING, "No physical address provided for memory error\n"); return; } mfn = bank->mc_addr >> PAGE_SHIFT; if (offline_page(mfn, 1, &status)) { dprintk(XENLOG_WARNING, "Failed to offline page %lx for MCE error\n", mfn); return; } mci_action_add_pageoffline(binfo->bank, binfo->mi, mfn, status); /* This is free page */ if (status & PG_OFFLINE_OFFLINED) *result = MCER_RECOVERED; else if (status & PG_OFFLINE_AGAIN) *result = MCER_CONTINUE; else if (status & PG_OFFLINE_PENDING) { /* This page has owner */ if (status & PG_OFFLINE_OWNED) { bank->mc_domid = status >> PG_OFFLINE_OWNER_SHIFT; mce_printk(MCE_QUIET, "MCE: This error page is ownded" " by DOM %d\n", bank->mc_domid); /* XXX: Cannot handle shared pages yet * (this should identify all domains and gfn mapping to * the mfn in question) */ BUG_ON( bank->mc_domid == DOMID_COW ); if ( bank->mc_domid != DOMID_XEN ) { d = get_domain_by_id(bank->mc_domid); ASSERT(d); gfn = get_gpfn_from_mfn((bank->mc_addr) >> PAGE_SHIFT); if ( !is_vmce_ready(bank, d) ) { printk("DOM%d not ready for vMCE\n", d->domain_id); goto vmce_failed; } if ( unmmap_broken_page(d, _mfn(mfn), gfn) ) { printk("Unmap broken memory %lx for DOM%d failed\n", mfn, d->domain_id); goto vmce_failed; } bank->mc_addr = gfn << PAGE_SHIFT | (bank->mc_addr & (PAGE_SIZE -1 )); if ( fill_vmsr_data(bank, d, global->mc_gstatus) == -1 ) { mce_printk(MCE_QUIET, "Fill vMCE# data for DOM%d " "failed\n", bank->mc_domid); goto vmce_failed; } if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) vmce_vcpuid = VMCE_INJECT_BROADCAST; else vmce_vcpuid = global->mc_vcpuid; /* We will inject vMCE to DOMU*/ if ( inject_vmce(d, vmce_vcpuid) < 0 ) { mce_printk(MCE_QUIET, "inject vMCE to DOM%d" " failed\n", d->domain_id); goto vmce_failed; } /* Impacted domain go on with domain's recovery job * if the domain has its own MCA handler. * For xen, it has contained the error and finished * its own recovery job. */ *result = MCER_RECOVERED; put_domain(d); return; vmce_failed: put_domain(d); domain_crash(d); } }