Commit 209ec1b8 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/mc: use split type+inst when handling dev_top interrupts



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent a35047ba
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ struct nvkm_top_device {

u32 nvkm_top_addr(struct nvkm_device *, enum nvkm_devidx);
u32 nvkm_top_reset(struct nvkm_device *, enum nvkm_subdev_type, int);
u32 nvkm_top_intr(struct nvkm_device *, u32 intr, u64 *subdevs);
u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_subdev_type, int);
int nvkm_top_fault_id(struct nvkm_device *, enum nvkm_devidx);
enum nvkm_devidx nvkm_top_fault(struct nvkm_device *, int fault);
+16 −9
Original line number Diff line number Diff line
@@ -78,22 +78,29 @@ void
nvkm_mc_intr(struct nvkm_device *device, bool *handled)
{
	struct nvkm_mc *mc = device->mc;
	struct nvkm_top *top = device->top;
	struct nvkm_top_device *tdev;
	struct nvkm_subdev *subdev;
	const struct nvkm_mc_map *map;
	u32 stat, intr;
	u64 subdevs;

	if (unlikely(!mc))
		return;

	intr = nvkm_mc_intr_stat(mc);
	stat = nvkm_top_intr(device, intr, &subdevs);
	while (subdevs) {
		enum nvkm_devidx subidx = __ffs64(subdevs);
		subdev = nvkm_device_subdev(device, subidx, 0);
		if (subdev)
	stat = intr = nvkm_mc_intr_stat(mc);

	if (top) {
		list_for_each_entry(tdev, &top->device, head) {
			if (tdev->intr >= 0 && (stat & BIT(tdev->intr))) {
				subdev = nvkm_device_subdev(device, tdev->type, tdev->inst);
				if (subdev) {
					nvkm_subdev_intr(subdev);
		subdevs &= ~BIT_ULL(subidx);
					stat &= ~BIT(tdev->intr);
					if (!stat)
						break;
				}
			}
		}
	}

	for (map = mc->func->intr; map->stat; map++) {
+0 −23
Original line number Diff line number Diff line
@@ -90,29 +90,6 @@ nvkm_top_intr_mask(struct nvkm_device *device, enum nvkm_subdev_type type, int i
	return 0;
}

u32
nvkm_top_intr(struct nvkm_device *device, u32 intr, u64 *psubdevs)
{
	struct nvkm_top *top = device->top;
	struct nvkm_top_device *info;
	u64 subdevs = 0;
	u32 handled = 0;

	if (top) {
		list_for_each_entry(info, &top->device, head) {
			if (info->index != NVKM_SUBDEV_NR && info->intr >= 0) {
				if (intr & BIT(info->intr)) {
					subdevs |= BIT_ULL(info->index);
					handled |= BIT(info->intr);
				}
			}
		}
	}

	*psubdevs = subdevs;
	return intr & ~handled;
}

int
nvkm_top_fault_id(struct nvkm_device *device, enum nvkm_devidx devidx)
{