Browse Source

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  Use atomic for start_count in devstat_start_transaction().
  [PowerPC] Fix panic when attempting to handle an HMI from an idle thread
  sc(4) md bits: stop setting sc->kbd entirely
  virtio_random(4): Drop no longer needed unload kludge
  random(4): Make entropy source deregistration safe
  Retire nstart/nend counters.
hardened/current/master
HardenedBSD Sync Service 6 months ago
parent
commit
60682b0afe
19 changed files with 82 additions and 92 deletions
  1. +0
    -1
      sys/arm/arm/sc_machdep.c
  2. +1
    -13
      sys/cam/ctl/ctl_backend_block.c
  3. +0
    -6
      sys/dev/md/md.c
  4. +0
    -5
      sys/dev/nvdimm/nvdimm_spa.c
  5. +0
    -1
      sys/dev/nvdimm/nvdimm_var.h
  6. +50
    -10
      sys/dev/random/random_harvestq.c
  7. +0
    -8
      sys/dev/virtio/random/virtio_random.c
  8. +2
    -1
      sys/geom/geom.h
  9. +1
    -8
      sys/geom/geom_disk.c
  10. +2
    -5
      sys/geom/geom_event.c
  11. +10
    -17
      sys/geom/geom_io.c
  12. +5
    -2
      sys/geom/geom_subr.c
  13. +0
    -1
      sys/isa/syscons_isa.c
  14. +1
    -6
      sys/kern/subr_devstat.c
  15. +0
    -1
      sys/mips/mips/sc_machdep.c
  16. +2
    -1
      sys/powerpc/include/pcpu.h
  17. +8
    -4
      sys/powerpc/powernv/opal_hmi.c
  18. +0
    -1
      sys/powerpc/powerpc/sc_machdep.c
  19. +0
    -1
      sys/sparc64/sparc64/sc_machdep.c

+ 0
- 1
sys/arm/arm/sc_machdep.c View File

@@ -69,7 +69,6 @@ sc_get_softc(int unit, int flags)
sc = &sc_softcs[unit];
sc->unit = unit;
if ((sc->flags & SC_INIT_DONE) == 0) {
sc->kbd = NULL;
sc->adapter = -1;
sc->cursor_char = SC_CURSOR_CHAR;
sc->mouse_char = SC_MOUSE_CHAR;

+ 1
- 13
sys/cam/ctl/ctl_backend_block.c View File

@@ -580,9 +580,7 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun,
DPRINTF("entered\n");

binuptime(&beio->ds_t0);
mtx_lock(&be_lun->io_lock);
devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0);
mtx_unlock(&be_lun->io_lock);

(void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT);

@@ -663,9 +661,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun,
}

binuptime(&beio->ds_t0);
mtx_lock(&be_lun->io_lock);
devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0);
mtx_unlock(&be_lun->io_lock);

if (beio->bio_cmd == BIO_READ) {
vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
@@ -894,9 +890,7 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun,
}

binuptime(&beio->ds_t0);
mtx_lock(&be_lun->io_lock);
devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0);
mtx_unlock(&be_lun->io_lock);

csw = devvn_refthread(be_lun->vn, &dev, &ref);
if (csw) {
@@ -1034,9 +1028,7 @@ ctl_be_block_flush_dev(struct ctl_be_block_lun *be_lun,
beio->send_complete = 1;

binuptime(&beio->ds_t0);
mtx_lock(&be_lun->io_lock);
devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0);
mtx_unlock(&be_lun->io_lock);

csw = devvn_refthread(be_lun->vn, &dev, &ref);
if (csw) {
@@ -1107,9 +1099,7 @@ ctl_be_block_unmap_dev(struct ctl_be_block_lun *be_lun,
DPRINTF("entered\n");

binuptime(&beio->ds_t0);
mtx_lock(&be_lun->io_lock);
devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0);
mtx_unlock(&be_lun->io_lock);

if (beio->io_offset == -1) {
beio->io_len = 0;
@@ -1186,11 +1176,9 @@ ctl_be_block_dispatch_dev(struct ctl_be_block_lun *be_lun,
beio->num_bios_sent++;
}
}
beio->send_complete = 1;
binuptime(&beio->ds_t0);
mtx_lock(&be_lun->io_lock);
devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0);
beio->send_complete = 1;
mtx_unlock(&be_lun->io_lock);

/*
* Fire off all allocated requests!

+ 0
- 6
sys/dev/md/md.c View File

@@ -247,7 +247,6 @@ struct md_s {
LIST_ENTRY(md_s) list;
struct bio_queue_head bio_queue;
struct mtx queue_mtx;
struct mtx stat_mtx;
struct cdev *dev;
enum md_types type;
off_t mediasize;
@@ -477,9 +476,7 @@ g_md_start(struct bio *bp)

sc = bp->bio_to->geom->softc;
if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE)) {
mtx_lock(&sc->stat_mtx);
devstat_start_transaction_bio(sc->devstat, bp);
mtx_unlock(&sc->stat_mtx);
}
mtx_lock(&sc->queue_mtx);
bioq_disksort(&sc->bio_queue, bp);
@@ -1274,7 +1271,6 @@ mdnew(int unit, int *errp, enum md_types type)
sc->type = type;
bioq_init(&sc->bio_queue);
mtx_init(&sc->queue_mtx, "md bio queue", NULL, MTX_DEF);
mtx_init(&sc->stat_mtx, "md stat", NULL, MTX_DEF);
sc->unit = unit;
sprintf(sc->name, "md%d", unit);
LIST_INSERT_HEAD(&md_softc_list, sc, list);
@@ -1282,7 +1278,6 @@ mdnew(int unit, int *errp, enum md_types type)
if (error == 0)
return (sc);
LIST_REMOVE(sc, list);
mtx_destroy(&sc->stat_mtx);
mtx_destroy(&sc->queue_mtx);
free_unr(md_uh, sc->unit);
free(sc, M_MD);
@@ -1512,7 +1507,6 @@ mddestroy(struct md_s *sc, struct thread *td)
while (!(sc->flags & MD_EXITING))
msleep(sc->procp, &sc->queue_mtx, PRIBIO, "mddestroy", hz / 10);
mtx_unlock(&sc->queue_mtx);
mtx_destroy(&sc->stat_mtx);
mtx_destroy(&sc->queue_mtx);
if (sc->vnode != NULL) {
vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY);

+ 0
- 5
sys/dev/nvdimm/nvdimm_spa.c View File

@@ -413,9 +413,7 @@ nvdimm_spa_g_start(struct bio *bp)

sc = bp->bio_to->geom->softc;
if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) {
mtx_lock(&sc->spa_g_stat_mtx);
devstat_start_transaction_bio(sc->spa_g_devstat, bp);
mtx_unlock(&sc->spa_g_stat_mtx);
}
mtx_lock(&sc->spa_g_mtx);
bioq_disksort(&sc->spa_g_queue, bp);
@@ -544,14 +542,12 @@ nvdimm_spa_g_create(struct nvdimm_spa_dev *dev, const char *name)
sc->dev = dev;
bioq_init(&sc->spa_g_queue);
mtx_init(&sc->spa_g_mtx, "spag", NULL, MTX_DEF);
mtx_init(&sc->spa_g_stat_mtx, "spagst", NULL, MTX_DEF);
sc->spa_g_proc_run = true;
sc->spa_g_proc_exiting = false;
error = kproc_create(nvdimm_spa_g_thread, sc, &sc->spa_g_proc, 0, 0,
"g_spa");
if (error != 0) {
mtx_destroy(&sc->spa_g_mtx);
mtx_destroy(&sc->spa_g_stat_mtx);
free(sc, M_NVDIMM);
printf("NVDIMM %s cannot create geom worker, error %d\n", name,
error);
@@ -621,7 +617,6 @@ nvdimm_spa_g_destroy_geom(struct gctl_req *req, struct g_class *cp,
sc->spa_g_devstat = NULL;
}
mtx_destroy(&sc->spa_g_mtx);
mtx_destroy(&sc->spa_g_stat_mtx);
free(sc, M_NVDIMM);
return (0);
}

+ 0
- 1
sys/dev/nvdimm/nvdimm_var.h View File

@@ -129,7 +129,6 @@ struct g_spa {
struct g_provider *spa_p;
struct bio_queue_head spa_g_queue;
struct mtx spa_g_mtx;
struct mtx spa_g_stat_mtx;
struct devstat *spa_g_devstat;
struct proc *spa_g_proc;
bool spa_g_proc_run;

+ 50
- 10
sys/dev/random/random_harvestq.c View File

@@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ck.h>
#include <sys/conf.h>
#include <sys/epoch.h>
#include <sys/eventhandler.h>
#include <sys/hash.h>
#include <sys/kernel.h>
@@ -75,6 +77,14 @@ static void random_sources_feed(void);

static u_int read_rate;

/*
* Random must initialize much earlier than epoch, but we can initialize the
* epoch code before SMP starts. Prior to SMP, we can safely bypass
* concurrency primitives.
*/
static __read_mostly bool epoch_inited;
static __read_mostly epoch_t rs_epoch;

/*
* How many events to queue up. We create this many items in
* an 'empty' queue, then transfer them to the 'harvest' queue with
@@ -94,12 +104,12 @@ volatile int random_kthread_control;
__read_frequently u_int hc_source_mask;

struct random_sources {
LIST_ENTRY(random_sources) rrs_entries;
CK_LIST_ENTRY(random_sources) rrs_entries;
struct random_source *rrs_source;
};

static LIST_HEAD(sources_head, random_sources) source_list =
LIST_HEAD_INITIALIZER(source_list);
static CK_LIST_HEAD(sources_head, random_sources) source_list =
CK_LIST_HEAD_INITIALIZER(source_list);

SYSCTL_NODE(_kern_random, OID_AUTO, harvest, CTLFLAG_RW, 0,
"Entropy Device Parameters");
@@ -202,6 +212,14 @@ random_kthread(void)
SYSINIT(random_device_h_proc, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, kproc_start,
&random_proc_kp);

static void
rs_epoch_init(void *dummy __unused)
{
rs_epoch = epoch_alloc("Random Sources", EPOCH_PREEMPT);
epoch_inited = true;
}
SYSINIT(rs_epoch_init, SI_SUB_EPOCH, SI_ORDER_ANY, rs_epoch_init, NULL);

/*
* Run through all fast sources reading entropy for the given
* number of rounds, which should be a multiple of the number
@@ -211,8 +229,12 @@ static void
random_sources_feed(void)
{
uint32_t entropy[HARVESTSIZE];
struct epoch_tracker et;
struct random_sources *rrs;
u_int i, n, local_read_rate;
bool rse_warm;

rse_warm = epoch_inited;

/*
* Step over all of live entropy sources, and feed their output
@@ -223,7 +245,9 @@ random_sources_feed(void)
local_read_rate = MAX(local_read_rate, 1);
/* But not exceeding RANDOM_KEYSIZE_WORDS */
local_read_rate = MIN(local_read_rate, RANDOM_KEYSIZE_WORDS);
LIST_FOREACH(rrs, &source_list, rrs_entries) {
if (rse_warm)
epoch_enter_preempt(rs_epoch, &et);
CK_LIST_FOREACH(rrs, &source_list, rrs_entries) {
for (i = 0; i < p_random_alg_context->ra_poolcount*local_read_rate; i++) {
n = rrs->rrs_source->rs_read(entropy, sizeof(entropy));
KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy)));
@@ -243,6 +267,8 @@ random_sources_feed(void)
random_harvest_direct(entropy, n, rrs->rrs_source->rs_source);
}
}
if (rse_warm)
epoch_exit_preempt(rs_epoch, &et);
explicit_bzero(entropy, sizeof(entropy));
}

@@ -573,7 +599,10 @@ random_source_register(struct random_source *rsource)
random_harvest_register_source(rsource->rs_source);

printf("random: registering fast source %s\n", rsource->rs_ident);
LIST_INSERT_HEAD(&source_list, rrs, rrs_entries);

RANDOM_HARVEST_LOCK();
CK_LIST_INSERT_HEAD(&source_list, rrs, rrs_entries);
RANDOM_HARVEST_UNLOCK();
}

void
@@ -585,29 +614,40 @@ random_source_deregister(struct random_source *rsource)

random_harvest_deregister_source(rsource->rs_source);

LIST_FOREACH(rrs, &source_list, rrs_entries)
RANDOM_HARVEST_LOCK();
CK_LIST_FOREACH(rrs, &source_list, rrs_entries)
if (rrs->rrs_source == rsource) {
LIST_REMOVE(rrs, rrs_entries);
CK_LIST_REMOVE(rrs, rrs_entries);
break;
}
if (rrs != NULL)
free(rrs, M_ENTROPY);
RANDOM_HARVEST_UNLOCK();

if (rrs != NULL && epoch_inited)
epoch_wait_preempt(rs_epoch);
free(rrs, M_ENTROPY);
}

static int
random_source_handler(SYSCTL_HANDLER_ARGS)
{
struct epoch_tracker et;
struct random_sources *rrs;
struct sbuf sbuf;
int error, count;

error = sysctl_wire_old_buffer(req, 0);
if (error != 0)
return (error);

sbuf_new_for_sysctl(&sbuf, NULL, 64, req);
count = 0;
LIST_FOREACH(rrs, &source_list, rrs_entries) {
epoch_enter_preempt(rs_epoch, &et);
CK_LIST_FOREACH(rrs, &source_list, rrs_entries) {
sbuf_cat(&sbuf, (count++ ? ",'" : "'"));
sbuf_cat(&sbuf, rrs->rrs_source->rs_ident);
sbuf_cat(&sbuf, "'");
}
epoch_exit_preempt(rs_epoch, &et);
error = sbuf_finish(&sbuf);
sbuf_delete(&sbuf);
return (error);

+ 0
- 8
sys/dev/virtio/random/virtio_random.c View File

@@ -176,14 +176,6 @@ vtrnd_detach(device_t dev)

random_source_deregister(&random_vtrnd);
atomic_store_explicit(&g_vtrnd_softc, NULL, memory_order_release);

/*
* Unfortunately, deregister does not guarantee our source callback
* will not be invoked after it returns. Use a kludge to prevent some,
* but not all, possible races.
*/
tsleep_sbt(&g_vtrnd_softc, 0, "vtrnddet", mstosbt(50), 0, C_HARDCLOCK);

return (0);
}


+ 2
- 1
sys/geom/geom.h View File

@@ -218,7 +218,8 @@ struct g_provider {
off_t stripesize;
off_t stripeoffset;
struct devstat *stat;
u_int nstart, nend;
u_int spare1;
u_int spare2;
u_int flags;
#define G_PF_WITHER 0x2
#define G_PF_ORPHAN 0x4

+ 1
- 8
sys/geom/geom_disk.c View File

@@ -64,13 +64,12 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>

struct g_disk_softc {
struct mtx done_mtx;
struct disk *dp;
struct sysctl_ctx_list sysctl_ctx;
struct sysctl_oid *sysctl_tree;
char led[64];
uint32_t state;
struct mtx start_mtx;
struct mtx done_mtx;
};

static g_access_t g_disk_access;
@@ -473,9 +472,7 @@ g_disk_start(struct bio *bp)
bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize;
bp2->bio_bcount = bp2->bio_length;
bp2->bio_disk = dp;
mtx_lock(&sc->start_mtx);
devstat_start_transaction_bio(dp->d_devstat, bp2);
mtx_unlock(&sc->start_mtx);
dp->d_strategy(bp2);

if (bp3 == NULL)
@@ -559,9 +556,7 @@ g_disk_start(struct bio *bp)
}
bp2->bio_done = g_disk_done;
bp2->bio_disk = dp;
mtx_lock(&sc->start_mtx);
devstat_start_transaction_bio(dp->d_devstat, bp2);
mtx_unlock(&sc->start_mtx);
dp->d_strategy(bp2);
break;
default:
@@ -709,7 +704,6 @@ g_disk_create(void *arg, int flag)
mtx_pool_unlock(mtxpool_sleep, dp);

sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
mtx_init(&sc->start_mtx, "g_disk_start", NULL, MTX_DEF);
mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF);
sc->dp = dp;
gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit);
@@ -795,7 +789,6 @@ g_disk_providergone(struct g_provider *pp)
pp->private = NULL;
pp->geom->softc = NULL;
mtx_destroy(&sc->done_mtx);
mtx_destroy(&sc->start_mtx);
g_free(sc);
}


+ 2
- 5
sys/geom/geom_event.c View File

@@ -241,10 +241,7 @@ one_event(void)

g_topology_assert();
mtx_lock(&g_eventlock);
TAILQ_FOREACH(pp, &g_doorstep, orphan) {
if (pp->nstart == pp->nend)
break;
}
pp = TAILQ_FIRST(&g_doorstep);
if (pp != NULL) {
G_VALID_PROVIDER(pp);
TAILQ_REMOVE(&g_doorstep, pp, orphan);
@@ -299,7 +296,7 @@ g_run_events()
} else {
g_topology_unlock();
msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP,
"-", TAILQ_EMPTY(&g_doorstep) ? 0 : hz / 10);
"-", 0);
}
}
/* NOTREACHED */

+ 10
- 17
sys/geom/geom_io.c View File

@@ -490,7 +490,6 @@ void
g_io_request(struct bio *bp, struct g_consumer *cp)
{
struct g_provider *pp;
struct mtx *mtxp;
int direct, error, first;
uint8_t cmd;

@@ -545,11 +544,19 @@ g_io_request(struct bio *bp, struct g_consumer *cp)

KASSERT(!(bp->bio_flags & BIO_ONQUEUE),
("Bio already on queue bp=%p", bp));

if ((g_collectstats & G_STATS_CONSUMERS) != 0 ||
((g_collectstats & G_STATS_PROVIDERS) != 0 && pp->stat != NULL))
binuptime(&bp->bio_t0);
else
getbinuptime(&bp->bio_t0);
if (g_collectstats & G_STATS_CONSUMERS)
devstat_start_transaction(cp->stat, &bp->bio_t0);
if (g_collectstats & G_STATS_PROVIDERS)
devstat_start_transaction(pp->stat, &bp->bio_t0);
#ifdef INVARIANTS
atomic_add_int(&cp->nstart, 1);
#endif

#ifdef GET_STACK_USAGE
direct = (cp->flags & G_CF_DIRECT_SEND) != 0 &&
@@ -569,21 +576,6 @@ g_io_request(struct bio *bp, struct g_consumer *cp)
direct = 0;
#endif

/*
* The statistics collection is lockless, as such, but we
* can not update one instance of the statistics from more
* than one thread at a time, so grab the lock first.
*/
mtxp = mtx_pool_find(mtxpool_sleep, pp);
mtx_lock(mtxp);
if (g_collectstats & G_STATS_PROVIDERS)
devstat_start_transaction(pp->stat, &bp->bio_t0);
if (g_collectstats & G_STATS_CONSUMERS)
devstat_start_transaction(cp->stat, &bp->bio_t0);
pp->nstart++;
cp->nstart++;
mtx_unlock(mtxp);

if (direct) {
error = g_io_check(bp);
if (error >= 0) {
@@ -691,8 +683,9 @@ g_io_deliver(struct bio *bp, int error)
devstat_end_transaction_bio_bt(pp->stat, bp, &now);
if (g_collectstats & G_STATS_CONSUMERS)
devstat_end_transaction_bio_bt(cp->stat, bp, &now);
#ifdef INVARIANTS
cp->nend++;
pp->nend++;
#endif
mtx_unlock(mtxp);

if (error != ENOMEM) {

+ 5
- 2
sys/geom/geom_subr.c View File

@@ -939,6 +939,9 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int dce)
KASSERT(cp->acw + dcw >= 0, ("access resulting in negative acw"));
KASSERT(cp->ace + dce >= 0, ("access resulting in negative ace"));
KASSERT(dcr != 0 || dcw != 0 || dce != 0, ("NOP access request"));
KASSERT(cp->acr + dcr != 0 || cp->acw + dcw != 0 ||
cp->ace + dce != 0 || cp->nstart == cp->nend,
("Last close with active requests"));
KASSERT(gp->access != NULL, ("NULL geom->access"));

/*
@@ -1426,8 +1429,10 @@ db_show_geom_consumer(int indent, struct g_consumer *cp)
}
gprintln(" access: r%dw%de%d", cp->acr, cp->acw, cp->ace);
gprintln(" flags: 0x%04x", cp->flags);
#ifdef INVARIANTS
gprintln(" nstart: %u", cp->nstart);
gprintln(" nend: %u", cp->nend);
#endif
} else {
gprintf("consumer: %p (%s), access=r%dw%de%d", cp,
cp->provider != NULL ? cp->provider->name : "none",
@@ -1459,8 +1464,6 @@ db_show_geom_provider(int indent, struct g_provider *pp)
provider_flags_to_string(pp, flags, sizeof(flags)),
pp->flags);
gprintln(" error: %d", pp->error);
gprintln(" nstart: %u", pp->nstart);
gprintln(" nend: %u", pp->nend);
if (LIST_EMPTY(&pp->consumers))
gprintln(" consumers: none");
} else {

+ 0
- 1
sys/isa/syscons_isa.c View File

@@ -117,7 +117,6 @@ sc_softc_t
}
sc->unit = unit;
if ((sc->flags & SC_INIT_DONE) == 0) {
sc->kbd = NULL;
sc->adapter = -1;
sc->cursor_char = SC_CURSOR_CHAR;
sc->mouse_char = SC_MOUSE_CHAR;

+ 1
- 6
sys/kern/subr_devstat.c View File

@@ -227,8 +227,6 @@ void
devstat_start_transaction(struct devstat *ds, const struct bintime *now)
{

mtx_assert(&devstat_mutex, MA_NOTOWNED);

/* sanity check */
if (ds == NULL)
return;
@@ -239,13 +237,12 @@ devstat_start_transaction(struct devstat *ds, const struct bintime *now)
* to busy. The start time is really the start of the latest busy
* period.
*/
if (ds->start_count == ds->end_count) {
if (atomic_fetchadd_int(&ds->start_count, 1) == ds->end_count) {
if (now != NULL)
ds->busy_from = *now;
else
binuptime(&ds->busy_from);
}
ds->start_count++;
atomic_add_rel_int(&ds->sequence0, 1);
DTRACE_DEVSTAT_START();
}
@@ -254,8 +251,6 @@ void
devstat_start_transaction_bio(struct devstat *ds, struct bio *bp)
{

mtx_assert(&devstat_mutex, MA_NOTOWNED);

/* sanity check */
if (ds == NULL)
return;

+ 0
- 1
sys/mips/mips/sc_machdep.c View File

@@ -69,7 +69,6 @@ sc_get_softc(int unit, int flags)
sc = &sc_softcs[unit];
sc->unit = unit;
if ((sc->flags & SC_INIT_DONE) == 0) {
sc->kbd = NULL;
sc->adapter = -1;
sc->cursor_char = SC_CURSOR_CHAR;
sc->mouse_char = SC_MOUSE_CHAR;

+ 2
- 1
sys/powerpc/include/pcpu.h View File

@@ -68,7 +68,8 @@ struct pvo_entry;
uint8_t slbstack[1024]; \
struct pvo_entry *qmap_pvo; \
struct mtx qmap_lock; \
char __pad[1345];
uint64_t opal_hmi_flags; \
char __pad[1337];

#ifdef __powerpc64__
#define PCPU_MD_AIM_FIELDS PCPU_MD_AIM64_FIELDS

+ 8
- 4
sys/powerpc/powernv/opal_hmi.c View File

@@ -84,13 +84,17 @@ opal_hmi_event_handler(void *unused, struct opal_msg *msg)
static int
opal_hmi_handler2(struct trapframe *frame)
{
uint64_t flags;
/*
* Use DMAP preallocated pcpu memory to handle
* the phys flags pointer.
*/
uint64_t *flags = PCPU_PTR(aim.opal_hmi_flags);
int err;

flags = 0;
err = opal_call(OPAL_HANDLE_HMI2, vtophys(&flags));
*flags = 0;
err = opal_call(OPAL_HANDLE_HMI2, DMAP_TO_PHYS((vm_offset_t)flags));

if (flags & OPAL_HMI_FLAGS_TOD_TB_FAIL)
if (*flags & OPAL_HMI_FLAGS_TOD_TB_FAIL)
panic("TOD/TB recovery failure");

if (err == OPAL_SUCCESS)

+ 0
- 1
sys/powerpc/powerpc/sc_machdep.c View File

@@ -69,7 +69,6 @@ sc_get_softc(int unit, int flags)
sc = &sc_softcs[unit];
sc->unit = unit;
if ((sc->flags & SC_INIT_DONE) == 0) {
sc->kbd = NULL;
sc->adapter = -1;
sc->cursor_char = SC_CURSOR_CHAR;
sc->mouse_char = SC_MOUSE_CHAR;

+ 0
- 1
sys/sparc64/sparc64/sc_machdep.c View File

@@ -131,7 +131,6 @@ sc_get_softc(int unit, int flags)
sc = &sc_softcs[unit];
sc->unit = unit;
if ((sc->flags & SC_INIT_DONE) == 0) {
sc->kbd = NULL;
sc->adapter = -1;
sc->cursor_char = SC_CURSOR_CHAR;
sc->mouse_char = SC_MOUSE_CHAR;

Loading…
Cancel
Save