Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8229bed authored by Jack Steiner's avatar Jack Steiner Committed by Linus Torvalds
Browse files

gru: add debug option for cache flushing



Add a debug option to the SGI GRU driver for flushing GRU cache lines from
memory.  In theory this is not needed but it is useful for debugging.
This has no use by end users.

Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7f2251b1
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -44,7 +44,8 @@ static int gru_user_copy_handle(void __user **dp, void *s)


static int gru_dump_context_data(void *grubase,
static int gru_dump_context_data(void *grubase,
			struct gru_context_configuration_handle *cch,
			struct gru_context_configuration_handle *cch,
			void __user *ubuf, int ctxnum, int dsrcnt)
			void __user *ubuf, int ctxnum, int dsrcnt,
			int flush_cbrs)
{
{
	void *cb, *cbe, *tfh, *gseg;
	void *cb, *cbe, *tfh, *gseg;
	int i, scr;
	int i, scr;
@@ -55,6 +56,8 @@ static int gru_dump_context_data(void *grubase,
	tfh = grubase + GRU_TFH_BASE;
	tfh = grubase + GRU_TFH_BASE;


	for_each_cbr_in_allocation_map(i, &cch->cbr_allocation_map, scr) {
	for_each_cbr_in_allocation_map(i, &cch->cbr_allocation_map, scr) {
		if (flush_cbrs)
			gru_flush_cache(cb);
		if (gru_user_copy_handle(&ubuf, cb))
		if (gru_user_copy_handle(&ubuf, cb))
			goto fail;
			goto fail;
		if (gru_user_copy_handle(&ubuf, tfh + i * GRU_HANDLE_STRIDE))
		if (gru_user_copy_handle(&ubuf, tfh + i * GRU_HANDLE_STRIDE))
@@ -115,7 +118,7 @@ static int gru_dump_tgh(struct gru_state *gru,


static int gru_dump_context(struct gru_state *gru, int ctxnum,
static int gru_dump_context(struct gru_state *gru, int ctxnum,
		void __user *ubuf, void __user *ubufend, char data_opt,
		void __user *ubuf, void __user *ubufend, char data_opt,
		char lock_cch)
		char lock_cch, char flush_cbrs)
{
{
	struct gru_dump_context_header hdr;
	struct gru_dump_context_header hdr;
	struct gru_dump_context_header __user *uhdr = ubuf;
	struct gru_dump_context_header __user *uhdr = ubuf;
@@ -159,8 +162,7 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
			ret = -EFBIG;
			ret = -EFBIG;
		else
		else
			ret = gru_dump_context_data(grubase, cch, ubuf, ctxnum,
			ret = gru_dump_context_data(grubase, cch, ubuf, ctxnum,
							dsrcnt);
							dsrcnt, flush_cbrs);

	}
	}
	if (cch_locked)
	if (cch_locked)
		unlock_cch_handle(cch);
		unlock_cch_handle(cch);
@@ -215,7 +217,8 @@ int gru_dump_chiplet_request(unsigned long arg)
	for (ctxnum = 0; ctxnum < GRU_NUM_CCH; ctxnum++) {
	for (ctxnum = 0; ctxnum < GRU_NUM_CCH; ctxnum++) {
		if (req.ctxnum == ctxnum || req.ctxnum < 0) {
		if (req.ctxnum == ctxnum || req.ctxnum < 0) {
			ret = gru_dump_context(gru, ctxnum, ubuf, ubufend,
			ret = gru_dump_context(gru, ctxnum, ubuf, ubufend,
						req.data_opt, req.lock_cch);
						req.data_opt, req.lock_cch,
						req.flush_cbrs);
			if (ret < 0)
			if (ret < 0)
				goto fail;
				goto fail;
			ubuf += ret;
			ubuf += ret;
+2 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,8 @@ struct gru_dump_chiplet_state_req {
	int		ctxnum;
	int		ctxnum;
	char		data_opt;
	char		data_opt;
	char		lock_cch;
	char		lock_cch;
	char		flush_cbrs;
	char		fill[10];
	pid_t		pid;
	pid_t		pid;
	void		*buf;
	void		*buf;
	size_t		buflen;
	size_t		buflen;